Commit 644a0faa authored by Paul Eggert's avatar Paul Eggert
Browse files

* 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.
parent 9250f758
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
result might not fit in 'int'. 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 <eggert@cs.ucla.edu> 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
Assume freestanding C89 headers, string.h, stdlib.h. Assume freestanding C89 headers, string.h, stdlib.h.
......
...@@ -325,11 +325,10 @@ main (int argc, char **argv) ...@@ -325,11 +325,10 @@ main (int argc, char **argv)
if (desc < 0) if (desc < 0)
{ {
int mkstemp_errno = errno; int mkstemp_errno = errno;
char *message = (char *) xmalloc (strlen (tempname) + 50); error ("error while creating what would become the lock file",
sprintf (message, "creating %s, which would become the lock file", 0, 0);
tempname);
errno = mkstemp_errno; errno = mkstemp_errno;
pfatal_with_name (message); pfatal_with_name (tempname);
} }
close (desc); close (desc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment