@@ -52,7 +52,7 @@ int g_debugPort = 4000;
52
52
void appLog (const char *format, ...) {
53
53
va_list args;
54
54
va_start (args, format);
55
- unsigned size = vsnprintf (NULL , 0 , format, args);
55
+ unsigned size = format ? vsnprintf (NULL , 0 , format, args) : 0 ;
56
56
va_end (args);
57
57
58
58
if (size) {
@@ -68,7 +68,7 @@ void appLog(const char *format, ...) {
68
68
buf[i--] = ' \0 ' ;
69
69
}
70
70
strcat (buf, " \r\n " );
71
-
71
+
72
72
#if defined(WIN32)
73
73
OutputDebugString (buf);
74
74
#else
@@ -274,7 +274,7 @@ int main(int argc, char* argv[]) {
274
274
|| (strstr (s, " ://" ) != NULL ))) {
275
275
runFile = strdup (s);
276
276
} else if (chdir (s) != 0 ) {
277
- strcpy (opt_command, s);
277
+ strlcpy (opt_command, s, sizeof (opt_command) );
278
278
}
279
279
}
280
280
}
@@ -297,7 +297,7 @@ int main(int argc, char* argv[]) {
297
297
opt_quiet = false ;
298
298
break ;
299
299
case ' c' :
300
- strcpy (opt_command, optarg);
300
+ strlcpy (opt_command, optarg, sizeof (opt_command) );
301
301
break ;
302
302
case ' f' :
303
303
fontFamily = strdup (optarg);
@@ -323,7 +323,7 @@ int main(int argc, char* argv[]) {
323
323
break ;
324
324
case ' m' :
325
325
if (optarg) {
326
- strcpy (opt_modpath, optarg);
326
+ strlcpy (opt_modpath, optarg, sizeof (opt_modpath) );
327
327
}
328
328
break ;
329
329
case ' d' :
0 commit comments