diff options
| author | joerg <joerg@NetBSD.org> | 2011-05-11 23:20:46 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2011-05-11 23:20:46 +0000 |
| commit | b4e27ff7ed1ee543ec2f5dcac0ebc7407a187198 (patch) | |
| tree | a8f54e54b3a497bc277405c445b23c0434d09b9a /gnu | |
| parent | 27a363d0669e8152eeaebb272c07e85908a49102 (diff) | |
Fix two rather obviousbuffer overflows, one of them hitting all the time.
Inspired by corresponding FreeBSD patch.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/dist/texinfo/makeinfo/sectioning.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gnu/dist/texinfo/makeinfo/sectioning.c b/gnu/dist/texinfo/makeinfo/sectioning.c index e8f202ed700..73f21e0d84d 100644 --- a/gnu/dist/texinfo/makeinfo/sectioning.c +++ b/gnu/dist/texinfo/makeinfo/sectioning.c @@ -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 @@ current_chapter_number (void) 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); } } |
