MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add length check to signal string comparison

+8 -7
+5 -5
src/modules/child_process.c
··· 389 389 } else if (vtype(args[0]) == T_STR) { 390 390 size_t sig_len; 391 391 char *sig_str = js_getstr(js, args[0], &sig_len); 392 - if (strncmp(sig_str, "SIGTERM", sig_len) == 0) sig = SIGTERM; 393 - else if (strncmp(sig_str, "SIGKILL", sig_len) == 0) sig = SIGKILL; 394 - else if (strncmp(sig_str, "SIGINT", sig_len) == 0) sig = SIGINT; 395 - else if (strncmp(sig_str, "SIGHUP", sig_len) == 0) sig = SIGHUP; 396 - else if (strncmp(sig_str, "SIGQUIT", sig_len) == 0) sig = SIGQUIT; 392 + if (sig_len == 7 && strncmp(sig_str, "SIGTERM", 7) == 0) sig = SIGTERM; 393 + else if (sig_len == 7 && strncmp(sig_str, "SIGKILL", 7) == 0) sig = SIGKILL; 394 + else if (sig_len == 6 && strncmp(sig_str, "SIGINT", 6) == 0) sig = SIGINT; 395 + else if (sig_len == 6 && strncmp(sig_str, "SIGHUP", 6) == 0) sig = SIGHUP; 396 + else if (sig_len == 7 && strncmp(sig_str, "SIGQUIT", 7) == 0) sig = SIGQUIT; 397 397 } 398 398 } 399 399
+3 -2
src/modules/reflect.c
··· 273 273 274 274 if (t != T_OBJ && t != T_FUNC) return js_mkfalse(); 275 275 276 - if (js_get_slot(js, target, SLOT_FROZEN) == js_true) return js_false; 277 - if (js_get_slot(js, target, SLOT_SEALED) == js_true) return js_false; 276 + if (js_get_slot(js, target, SLOT_EXTENSIBLE) == js_false) return js_false; 277 + if (js_get_slot(js, target, SLOT_FROZEN) == js_true) return js_false; 278 + if (js_get_slot(js, target, SLOT_SEALED) == js_true) return js_false; 278 279 279 280 return js_mktrue(); 280 281 }