From: Holger Schemel Date: Mon, 2 Mar 2015 10:12:29 +0000 (+0100) Subject: added null pointer checks to string functions X-Git-Tag: 4.0.0.0-rc1~278 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=67299796d92e05c7748133815dce26209706ac7b added null pointer checks to string functions --- diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 259fb4de..5f9fb749 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -555,6 +555,9 @@ static char *getProgramMainDataPath() char *getStringCat2WithSeparator(char *s1, char *s2, char *sep) { + if (s1 == NULL || s2 == NULL || sep == NULL) + return NULL; + char *complete_string = checked_malloc(strlen(s1) + strlen(sep) + strlen(s2) + 1); @@ -565,6 +568,9 @@ char *getStringCat2WithSeparator(char *s1, char *s2, char *sep) char *getStringCat3WithSeparator(char *s1, char *s2, char *s3, char *sep) { + if (s1 == NULL || s2 == NULL || s3 == NULL || sep == NULL) + return NULL; + char *complete_string = checked_malloc(strlen(s1) + strlen(sep) + strlen(s2) + strlen(sep) + strlen(s3) + 1);