misc.c: in cm_mbchar check string!=NULL before dereferencing it

This commit is contained in:
Edmond Orignac
2021-06-02 19:56:28 -06:00
committed by Jon Trulson
parent 297918bb56
commit 53c35daea1
+2 -2
View File
@@ -639,7 +639,7 @@ cm_mbchar(char *str) {
free(buf);
buf = NULL;
}
if ( *string == '\0' ) {
if ( string != NULL && *string == '\0' ) {
free(string_head);
string_head = NULL;
string = NULL;
@@ -652,7 +652,7 @@ cm_mbchar(char *str) {
string += num_byte;
}
}
return buf;
}