Author: mdiep
Date: Thu Apr 26 21:30:50 2007
New Revision: 18342
Modified:
trunk/compilers/imcc/parser_util.c
Log:
#42594: [PATCH] Probable buffer overflow in compilers/imcc/parser_util.c
Courtesy Steve Peters <[EMAIL PROTECTED]>.
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c (original)
+++ trunk/compilers/imcc/parser_util.c Thu Apr 26 21:30:50 2007
@@ -494,8 +494,10 @@
if (len >= 2)
len -= 2;
format[len] = '\0';
- if (fmt && *fmt)
- strcpy(format, fmt);
+ if (fmt && *fmt) {
+ strncpy(format, fmt, sizeof(format) - 1);
+ format[sizeof(format) - 1] = '\0';
+ }
#if 1
IMCC_debug(interp, DEBUG_PARSER,"%s %s\t%s\n", name, format, fullname);
#endif