1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-29 11:59:36 +02:00

(print_it): Avoid buffer overrun that would occur

when the user-specified format string ends with `%'.
This commit is contained in:
Jim Meyering
2003-08-27 08:55:01 +00:00
parent e364229e33
commit e37cd8f9f4
+3 -2
View File
@@ -566,7 +566,6 @@ print_it (char const *masterformat, char const *filename,
char *dest = xmalloc (strlen (format) + 1);
b = format;
while (b)
{
@@ -583,9 +582,12 @@ print_it (char const *masterformat, char const *filename,
dest[1 + len] = 0;
p += len;
b = p + 1;
switch (*p)
{
case '\0':
b = NULL;
/* fall through */
case '%':
putchar ('%');
break;
@@ -593,7 +595,6 @@ print_it (char const *masterformat, char const *filename,
print_func (dest, *p, filename, data);
break;
}
b = p + 1;
}
else
{