Module Name: src
Committed By: joerg
Date: Wed May 11 23:20:46 UTC 2011
Modified Files:
src/gnu/dist/texinfo/makeinfo: sectioning.c
Log Message:
Fix two rather obviousbuffer overflows, one of them hitting all the time.
Inspired by corresponding FreeBSD patch.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.5 -r1.2 src/gnu/dist/texinfo/makeinfo/sectioning.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/gnu/dist/texinfo/makeinfo/sectioning.c
diff -u src/gnu/dist/texinfo/makeinfo/sectioning.c:1.1.1.5 src/gnu/dist/texinfo/makeinfo/sectioning.c:1.2
--- src/gnu/dist/texinfo/makeinfo/sectioning.c:1.1.1.5 Tue Sep 2 07:50:20 2008
+++ src/gnu/dist/texinfo/makeinfo/sectioning.c Wed May 11 23:20:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sectioning.c,v 1.1.1.5 2008/09/02 07:50:20 christos Exp $ */
+/* $NetBSD: sectioning.c,v 1.2 2011/05/11 23:20:46 joerg Exp $ */
/* sectioning.c -- for @chapter, @section, ..., @contents ...
Id: sectioning.c,v 1.25 2004/07/05 22:23:23 karl Exp
@@ -258,14 +258,13 @@
return xstrdup ("");
else if (enum_marker == APPENDIX_MAGIC)
{
- char s[1];
- sprintf (s, "%c", numbers[0] + 64);
+ char s[2] = { numbers[0] + 64, '\0' };
return xstrdup (s);
}
else
{
- char s[5];
- sprintf (s, "%d", numbers[0]);
+ char s[11];
+ snprintf (s, sizeof(s), "%d", numbers[0]);
return xstrdup (s);
}
}