projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d20ca7d
)
added null pointer checks to string functions
author
Holger Schemel
<info@artsoft.org>
Mon, 2 Mar 2015 10:12:29 +0000
(11:12 +0100)
committer
Holger Schemel
<info@artsoft.org>
Mon, 2 Mar 2015 10:12:29 +0000
(11:12 +0100)
src/libgame/misc.c
patch
|
blob
|
history
diff --git
a/src/libgame/misc.c
b/src/libgame/misc.c
index 259fb4dede6a1f3a41bf0fcf34e3cffffafa8d0d..5f9fb749b5d7dfb074da61537c58e37ff1e5da1c 100644
(file)
--- 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)
{
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);
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)
{
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);
char *complete_string = checked_malloc(strlen(s1) + strlen(sep) +
strlen(s2) + strlen(sep) +
strlen(s3) + 1);