projects
/
gnulib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
edafda5
)
Another fix to snprintf().
author
Bruno Haible
<bruno@clisp.org>
Fri, 1 Oct 2004 13:27:20 +0000
(13:27 +0000)
committer
Bruno Haible
<bruno@clisp.org>
Fri, 1 Oct 2004 13:27:20 +0000
(13:27 +0000)
lib/ChangeLog
patch
|
blob
|
history
lib/snprintf.c
patch
|
blob
|
history
diff --git
a/lib/ChangeLog
b/lib/ChangeLog
index
a701b15
..
7d2c828
100644
(file)
--- a/
lib/ChangeLog
+++ b/
lib/ChangeLog
@@
-1,4
+1,8
@@
2004-10-01 Simon Josefsson <jas@extundo.com>
+
+ * snprintf.c (snprintf): Handle size==0.
+
+2004-10-01 Simon Josefsson <jas@extundo.com>
Bruno Haible <bruno@clisp.org>
* snprintf.c: Include <stdarg.h>, <stdlib.h>, <string.h>.
diff --git
a/lib/snprintf.c
b/lib/snprintf.c
index
92c2652
..
c23d7e1
100644
(file)
--- a/
lib/snprintf.c
+++ b/
lib/snprintf.c
@@
-55,7
+55,7
@@
snprintf (char *str, size_t size, const char *format, ...)
if (!output)
return -1;
- if (str)
+ if (str
&& size > 0
)
{
memcpy (str, output, MIN (len + 1, size));
str[size - 1] = '\0';