projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e0f1095
)
added some safety checks to string functions
author
Holger Schemel
<info@artsoft.org>
Sun, 30 Jun 2024 14:39:18 +0000
(16:39 +0200)
committer
Holger Schemel
<info@artsoft.org>
Sun, 30 Jun 2024 14:39:18 +0000
(16:39 +0200)
src/libgame/misc.c
patch
|
blob
|
history
diff --git
a/src/libgame/misc.c
b/src/libgame/misc.c
index ed4bd5d62c991d7e94f72cb150ab904ee8c2935f..6b4acba8d2830f0188d1447030a1f85e882664bc 100644
(file)
--- 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;