From: Paul Eggert Date: Sun, 28 Aug 2011 23:57:19 +0000 (-0700) Subject: * movemail.c (main): Do not use sprintf when its result might not fit X-Git-Tag: emacs-pretest-24.0.90~104^2~153^2~1^2~37 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=644a0faa36ad8c1e251d198c2bc69f17c8bdb83a;p=emacs.git * movemail.c (main): Do not use sprintf when its result might not fit in 'int'. Instead, put the possibly-long file name into the output of pfatal_with_name. --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 8d46a37ce51..ca08ece7c39 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -26,6 +26,10 @@ greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its result might not fit in 'int'. + * movemail.c (main): Do not use sprintf when its result might not fit + in 'int'. Instead, put the possibly-long file name into the + output of pfatal_with_name. + 2011-07-28 Paul Eggert Assume freestanding C89 headers, string.h, stdlib.h. diff --git a/lib-src/movemail.c b/lib-src/movemail.c index d70c655adec..097bf23c202 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -325,11 +325,10 @@ main (int argc, char **argv) if (desc < 0) { int mkstemp_errno = errno; - char *message = (char *) xmalloc (strlen (tempname) + 50); - sprintf (message, "creating %s, which would become the lock file", - tempname); + error ("error while creating what would become the lock file", + 0, 0); errno = mkstemp_errno; - pfatal_with_name (message); + pfatal_with_name (tempname); } close (desc);