From: Holger Schemel Date: Sun, 30 Jun 2024 14:39:18 +0000 (+0200) Subject: added some safety checks to string functions X-Git-Tag: 4.4.0.0-test-3~13 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9b6032c77dce1efc1f5efa285c9a4321f6f5e9f3;p=rocksndiamonds.git added some safety checks to string functions --- diff --git a/src/libgame/misc.c b/src/libgame/misc.c index ed4bd5d6..6b4acba8 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1222,6 +1222,9 @@ char *getStringCopyNStatic(const char *s, int n) char *getStringToUpper(const char *s) { + if (s == NULL) + return NULL; + char *s_copy = checked_malloc(strlen(s) + 1); char *s_ptr = s_copy; @@ -1234,6 +1237,9 @@ char *getStringToUpper(const char *s) char *getStringToLower(const char *s) { + if (s == NULL) + return NULL; + char *s_copy = checked_malloc(strlen(s) + 1); char *s_ptr = s_copy;