# HG changeset patch # User Francesco Potort # Date 1023278969 0 # Node ID 5cee84ffef53b28c7925ab3f0829ac66af7d96d9 # Parent 13b00ebe25a76a3bd40381e94b0d7c8d11441bf0 (main): Avoid a buffer overrun with sprintf. diff -r 13b00ebe25a7 -r 5cee84ffef53 lib-src/etags.c --- a/lib-src/etags.c Wed Jun 05 07:08:54 2002 +0000 +++ b/lib-src/etags.c Wed Jun 05 12:09:29 2002 +0000 @@ -33,7 +33,7 @@ * Francesco Potort has maintained it since 1993. */ -char pot_etags_version[] = "@(#) pot revision number is 15.16"; +char pot_etags_version[] = "@(#) pot revision number is $Revision: 15.18 $"; #define TRUE 1 #define FALSE 0 @@ -441,7 +441,7 @@ static bool globals; /* create tags for global variables */ static bool declarations; /* --declarations: tag them and extern in C&Co*/ static bool members; /* create tags for C member variables */ -static bool no_line_directive; /* ignore #line directives */ +static bool no_line_directive; /* ignore #line directives (undocumented) */ static bool update; /* -u: update tags */ static bool vgrind_style; /* -v: create vgrind style index output */ static bool no_warnings; /* -w: suppress warnings */ @@ -1254,8 +1254,8 @@ if (update) { - char cmd[BUFSIZ]; - sprintf (cmd, "sort -o %s %s", tagfile, tagfile); + char cmd[2*BUFSIZ+10]; + sprintf (cmd, "sort -o %.*s %.*s", BUFSIZ, tagfile, BUFSIZ, tagfile); exit (system (cmd)); } return GOOD;