Fix infinite loop in extension detection when the needle is a substring.

We could keep examining the same ptr value over and over.
macos/v1.5.9
Eric Anholt 11 years ago
parent cb647a0853
commit 03e9537331
  1. 10
      src/dispatch_common.c

@ -265,11 +265,15 @@ epoxy_extension_in_string(const char *extension_list, const char *ext)
int len = strlen(ext); int len = strlen(ext);
/* Make sure that don't just find an extension with our name as a prefix. */ /* Make sure that don't just find an extension with our name as a prefix. */
do { while (true) {
ptr = strstr(ptr, ext); ptr = strstr(ptr, ext);
} while (ptr && (ptr[len] != ' ' && ptr[len] != 0)); if (!ptr)
return false;
return ptr != NULL; if (ptr[len] == ' ' || ptr[len] == 0)
return true;
ptr += len;
}
} }
static bool static bool

Loading…
Cancel
Save