diff -Naur micro-evtd-3.3.3.orig/micro_evtd.c micro-evtd-3.3.3/micro_evtd.c --- micro-evtd-3.3.3.orig/micro_evtd.c 2009-03-15 11:41:36.011723240 -0700 +++ micro-evtd-3.3.3/micro_evtd.c 2009-03-15 11:48:35.531745776 -0700 @@ -400,10 +400,12 @@ static int execute_command2(char cmd, char* cmdstring, char type, char cmd2, long cmd3) { - char strEventScript[50]; + char strEventScript[256]; + int ret; // Create the command line - sprintf(strEventScript, "/%s/micro_evtd.event %c %d %ld %s %s %d %c", + ret = snprintf(strEventScript, 256, + "/%s/micro_evtd.event %c %d %ld %s %s %d %c", (CP_SCRIPT == cmd? "usr/sbin" : strTmpPath), cmd, cmd2, @@ -411,6 +413,12 @@ cmdstring, (CP_SCRIPT == cmd? strTmpPath : log_path), iDebugLevel, (CALL_NO_WAIT == type ? '&' : ' ')); + + // Check that string was not truncated + if(ret >= 256) { + syslog(LOG_ERR, "execute_command2(): command would overflow buffer"); + return -1; + } // Invoke request system(strEventScript);