From: Matt Birkholz Date: Thu, 21 Sep 2017 22:21:15 +0000 (-0700) Subject: gdbm: Ensure filename for do_gdbm_open is null terminated. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~22 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d7e71f0b9179f3c1a7b7f00ad75ab7373ea09b9f;p=mit-scheme.git gdbm: Ensure filename for do_gdbm_open is null terminated. --- 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"))