@@ -52,7 +52,7 @@ int g_debugPort = 4000;
5252void appLog (const char *format, ...) {
5353 va_list args;
5454 va_start (args, format);
55- unsigned size = vsnprintf (NULL , 0 , format, args);
55+ unsigned size = format ? vsnprintf (NULL , 0 , format, args) : 0 ;
5656 va_end (args);
5757
5858 if (size) {
@@ -68,7 +68,7 @@ void appLog(const char *format, ...) {
6868 buf[i--] = ' \0 ' ;
6969 }
7070 strcat (buf, " \r\n " );
71-
71+
7272#if defined(WIN32)
7373 OutputDebugString (buf);
7474#else
@@ -274,7 +274,7 @@ int main(int argc, char* argv[]) {
274274 || (strstr (s, " ://" ) != NULL ))) {
275275 runFile = strdup (s);
276276 } else if (chdir (s) != 0 ) {
277- strcpy (opt_command, s);
277+ strlcpy (opt_command, s, sizeof (opt_command) );
278278 }
279279 }
280280 }
@@ -297,7 +297,7 @@ int main(int argc, char* argv[]) {
297297 opt_quiet = false ;
298298 break ;
299299 case ' c' :
300- strcpy (opt_command, optarg);
300+ strlcpy (opt_command, optarg, sizeof (opt_command) );
301301 break ;
302302 case ' f' :
303303 fontFamily = strdup (optarg);
@@ -323,7 +323,7 @@ int main(int argc, char* argv[]) {
323323 break ;
324324 case ' m' :
325325 if (optarg) {
326- strcpy (opt_modpath, optarg);
326+ strlcpy (opt_modpath, optarg, sizeof (opt_modpath) );
327327 }
328328 break ;
329329 case ' d' :
0 commit comments