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:
@@ -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 == '*') {
|
||||
|
||||
Reference in New Issue
Block a user