From 3f4ba9f3880dfbc2a2f86303dc085c09e35790b2 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 13 Apr 2023 06:36:08 +0700 Subject: [PATCH] check for negative value in ptr_lstrip() (#988) * check for negative value in ptr_lstrip() This fixes parsing of DEHACKED in D2ISOv2.wad with debug version of CRT. If the value < 0 the behavior of `isspace()` is undefined according to the documentation. * disable vcpkg update --- src/d_deh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_deh.c b/src/d_deh.c index a34743e2..9bfa451f 100644 --- a/src/d_deh.c +++ b/src/d_deh.c @@ -3137,7 +3137,7 @@ void rstrip(char *s) // strip trailing whitespace // char *ptr_lstrip(char *p) // point past leading whitespace { - while (isspace(*p)) + while (*p >= 0 && isspace(*p)) p++; return p; }