X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fwrap.c;h=5f1873861ff765d228566564503db4107298affd;hb=decddddf7e581fa1ebee846e5fddcd52229bb9a8;hp=8e17e3711176b6801593556bfd1ae74fbc7d7848;hpb=77d46c398278c0bbe221722c21c01d47713cd878;p=sbcl.git diff --git a/src/runtime/wrap.c b/src/runtime/wrap.c index 8e17e37..5f18738 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) @@ -358,7 +359,7 @@ uid_homedir(uid_t uid) } else { char *result = malloc(len + 2); if (result) { - int nchars = sprintf(result,"%s/",p->pw_dir); + unsigned int nchars = sprintf(result,"%s/",p->pw_dir); if (nchars == len + 1) { return result; } else {