Skip to content

Commit 7f3c831

Browse files
committed
fix: validate strsep key/value are non-NULL in Clock2QPlus param parser
1 parent d8e414d commit 7f3c831

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

libCacheSim/cache/eviction/Clock2QPlus.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,11 @@ static void Clock2QPlus_parse_params(cache_t *cache,
489489
params_str++;
490490
}
491491

492+
if (key == NULL || value == NULL) {
493+
ERROR("invalid parameter string: missing key or value\n");
494+
exit(1);
495+
}
496+
492497
if (strcasecmp(key, "fifo-size-ratio") == 0) {
493498
params->fifo_size_ratio = strtod(value, NULL);
494499
} else if (strcasecmp(key, "ghost-size-ratio") == 0) {

0 commit comments

Comments
 (0)