mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 22:31:36 +00:00
Fix potential bug with derefrencing a NULL pointer
This commit is contained in:
parent
7501444add
commit
9031c57e39
1 changed files with 5 additions and 4 deletions
9
util.c
9
util.c
|
@ -106,13 +106,14 @@ char *util_strrq(char *s) {
|
|||
* done pointer wise instead of strlen(), and an array
|
||||
* access.
|
||||
*/
|
||||
char *util_strrnl(char *s) {
|
||||
char *cpy = s;
|
||||
while (cpy && *cpy && *cpy != '\n')
|
||||
char *util_strrnl(char *src) {
|
||||
if (!src) return NULL;
|
||||
char *cpy = src;
|
||||
while (*cpy && *cpy != '\n')
|
||||
cpy++;
|
||||
|
||||
*cpy = '\0';
|
||||
return s;
|
||||
return src;
|
||||
}
|
||||
|
||||
void util_debug(const char *area, const char *ms, ...) {
|
||||
|
|
Loading…
Reference in a new issue