From: notaz Date: Sat, 30 Sep 2023 19:43:03 +0000 (+0300) Subject: psxbios: more careful cnf parsing X-Git-Tag: r24~135 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=dc3178e9ced416632e8b5b5486bb35a561a6b2b9 psxbios: more careful cnf parsing --- 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() {