kex.c: make sure mlist is not set to NULL

... if the currently unsupported LANG methods are called.
Reported by Coverity CID 89834.
This commit is contained in:
Marc Hoersken 2014-12-26 13:20:14 +01:00
parent dc199ed03a
commit 3835655f09

View File

@ -1866,7 +1866,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION * session, int method_type,
}
memcpy(s, prefs, prefs_len + 1);
while (s && *s) {
while (s && *s && mlist) {
char *p = strchr(s, ',');
int method_len = p ? (p - s) : (int) strlen(s);