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