From 85c2c0dc6aa7d5370395cc0a24647d5effe35a0d Mon Sep 17 00:00:00 2001 From: Richard M Kreuter Date: Tue, 22 Jan 2008 17:14:31 +0000 Subject: [PATCH] 1.0.13.51: Fixups in mkstemp wrapper used in RUN-PROGRAM. * Preclude a buffer overflow (though one that cannot occur at present, given the single caller of this routine). Contributed by Alex Plotnick. --- src/runtime/wrap.c | 9 +++++---- version.lisp-expr | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/runtime/wrap.c b/src/runtime/wrap.c index 8e17e3711..2bda7f900 100644 --- a/src/runtime/wrap.c +++ b/src/runtime/wrap.c @@ -305,10 +305,11 @@ int sb_mkstemp (char *template, mode_t mode) { template on every loop, but only the last several characters. But I didn't feel like testing the boundary cases in Windows's _mktemp. */ - strcpy((char*)&buf, template); - if (MKTEMP((char*)&buf)) { - if ((fd=open((char*)&buf, O_CREAT|O_EXCL|O_RDWR, mode))!=-1) { - strcpy(template, (char*)&buf); + strncpy(buf, template, PATHNAME_BUFFER_SIZE); + buf[PATHNAME_BUFFER_SIZE-1]=0; /* force NULL-termination */ + if (MKTEMP(buf)) { + if ((fd=open(buf, O_CREAT|O_EXCL|O_RDWR, mode))!=-1) { + strcpy(template, buf); return (fd); } else if (errno != EEXIST) diff --git a/version.lisp-expr b/version.lisp-expr index 6c05f6a04..5e31ada4c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.13.50" +"1.0.13.51" -- 2.11.4.GIT