1
1

match: Don't dereference 's' directly.

Found by Coverity.
Этот коммит содержится в:
Andreas Schneider 2012-10-08 20:11:40 +02:00
родитель 87036839f9
Коммит ec56d1d453

Просмотреть файл

@ -46,10 +46,14 @@
* and * as wildcards), and zero if it does not match. * and * as wildcards), and zero if it does not match.
*/ */
static int match_pattern(const char *s, const char *pattern) { static int match_pattern(const char *s, const char *pattern) {
if (s == NULL || pattern == NULL) {
return 0;
}
for (;;) { for (;;) {
/* If at end of pattern, accept if also at end of string. */ /* If at end of pattern, accept if also at end of string. */
if (!*pattern) { if (*pattern == '\0') {
return !*s; return (*s == '\0');
} }
if (*pattern == '*') { if (*pattern == '*') {