Browse Source

Avoid an endless loop: Safeguard function

search_plain_identifier(char *str, const char *identifier)
against identifiers being an empty string.
pre-master-46
Holger Vogt 4 years ago
parent
commit
b94ef139dd
  1. 5
      src/frontend/inpcom.c

5
src/frontend/inpcom.c

@ -5168,10 +5168,11 @@ char *ya_search_identifier(char *str, const char *identifier, char *str_begin)
return str; return str;
} }
/* Check for 'identifier' being in string str, surrounded by chars
not being a member of alphanumeric or '_' characters. */
char *search_plain_identifier(char *str, const char *identifier) char *search_plain_identifier(char *str, const char *identifier)
{ {
if (str && identifier) {
if (str && identifier && *identifier != '\0') {
char *str_begin = str; char *str_begin = str;
while ((str = strstr(str, identifier)) != NULL) { while ((str = strstr(str, identifier)) != NULL) {
char before; char before;

Loading…
Cancel
Save