Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/gnu/dist/texinfo/makeinfo Fix two rather obviousbuffer overf...
details: https://anonhg.NetBSD.org/src/rev/72cfdadf0cf5
branches: trunk
changeset: 764918:72cfdadf0cf5
user: joerg <joerg%NetBSD.org@localhost>
date: Wed May 11 23:20:46 2011 +0000
description:
Fix two rather obviousbuffer overflows, one of them hitting all the time.
Inspired by corresponding FreeBSD patch.
diffstat:
gnu/dist/texinfo/makeinfo/sectioning.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diffs (27 lines):
diff -r e200a957990e -r 72cfdadf0cf5 gnu/dist/texinfo/makeinfo/sectioning.c
--- a/gnu/dist/texinfo/makeinfo/sectioning.c Wed May 11 22:26:46 2011 +0000
+++ b/gnu/dist/texinfo/makeinfo/sectioning.c Wed May 11 23:20:46 2011 +0000
@@ -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);
}
}
Home |
Main Index |
Thread Index |
Old Index