Skip to content

Commit

Permalink
Crash fix for str_cmp on null pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
luciensadi committed Sep 10, 2024
1 parent 9991dc8 commit efce62c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dblist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ void objList::CheckForDeletedCharacterFuckery(struct char_data *ch, const char *
continue;
}

if (!str_cmp(GET_CHAR_NAME(owner), their_name)) {
if (GET_CHAR_NAME(owner) && !str_cmp(GET_CHAR_NAME(owner), their_name)) {
mudlog_vfprintf(NULL, LOG_SYSLOG, "SYSERR: CheckForDeletedCharacterFuckery FOUND object %s (%ld) in objList after character deletion (name match)!", GET_OBJ_NAME(OBJ), GET_OBJ_VNUM(OBJ));
found_something = TRUE;
continue;
Expand Down
2 changes: 2 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ char *prep_string_for_writing_to_savefile(char *dest, const char *src)
/* scan 'till found different or end of both */
int str_cmp(const char *one, const char *two)
{
if (!one || !two)
return 1;
if (!*one || !*two)
return 1;
for (; *one; one++, two++) {
Expand Down

0 comments on commit efce62c

Please sign in to comment.