From dc3178e9ced416632e8b5b5486bb35a561a6b2b9 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 30 Sep 2023 22:43:03 +0300 Subject: [PATCH] psxbios: more careful cnf parsing --- libpcsxcore/misc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index da1dbea8..d748ac07 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -22,6 +22,7 @@ */ #include +#include #include #include "misc.h" #include "cdrom.h" @@ -174,8 +175,13 @@ static void getFromCnf(char *buf, const char *key, u32 *val) buf = strstr(buf, key); if (buf) buf = strchr(buf, '='); - if (buf) - *val = strtol(buf + 1, NULL, 16); + if (buf) { + unsigned long v; + errno = 0; + v = strtoul(buf + 1, NULL, 16); + if (errno == 0) + *val = v; + } } int LoadCdrom() { -- 2.39.2