1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-24 19:37:48 +03:00

match: Don't dereference 's' directly.

Found by Coverity.
This commit is contained in:
Andreas Schneider
2012-10-08 20:11:40 +02:00
parent 87036839f9
commit ec56d1d453

View File

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