From d7e71f0b9179f3c1a7b7f00ad75ab7373ea09b9f Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 21 Sep 2017 15:21:15 -0700 Subject: [PATCH] gdbm: Ensure filename for do_gdbm_open is null terminated. --- src/gdbm/gdbm.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gdbm/gdbm.scm b/src/gdbm/gdbm.scm index b337e47ff..26062f526 100644 --- a/src/gdbm/gdbm.scm +++ b/src/gdbm/gdbm.scm @@ -67,6 +67,7 @@ USA. #t))) (define (->bytes string) + ;; NOT necessarily null terminated (if (and (or (bytevector? string) (and (ustring? string) (fix:= 1 (ustring-cp-size string)))) @@ -102,7 +103,7 @@ USA. gdbf (lambda () (C-call "do_gdbm_open" - args (->bytes filename) block-size flagsnum mode) + args (string->utf8 filename) block-size flagsnum mode) (if (alien-null? args) (error "gdbm_open failed: malloc failed") (if (alien-null? (C-> args "gdbm_args dbf")) -- 2.25.1