]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
p_strndup() read str[max_chars] byte - could have possibly crashed in some
authorTimo Sirainen <tss@iki.fi>
Thu, 23 Oct 2003 08:30:04 +0000 (11:30 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 23 Oct 2003 08:30:04 +0000 (11:30 +0300)
rare conditions

--HG--
branch : HEAD

src/lib/strfuncs.c

index 0543874d690d478b1cdbc67a68b3febad3303567..f95c5732d14c2926ecdaee3bafbf0dc6888e719b 100644 (file)
@@ -168,7 +168,7 @@ char *p_strndup(pool_t pool, const void *str, size_t max_chars)
                return NULL;
 
        len = 0;
-       while (((const char *) str)[len] != '\0' && len < max_chars)
+       while (len < max_chars && ((const char *) str)[len] != '\0')
                len++;
 
        mem = p_malloc(pool, len+1);