Check for memset of zero
authorAlan T. DeKok <aland@freeradius.org>
Thu, 6 Sep 2012 09:22:24 +0000 (11:22 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 6 Sep 2012 09:33:18 +0000 (11:33 +0200)
src/lib/radius.c

index cb412c4..7c5a437 100644 (file)
@@ -514,7 +514,7 @@ static void make_passwd(uint8_t *output, size_t *outlen,
        if (len > MAX_PASS_LEN) len = MAX_PASS_LEN;
 
        memcpy(passwd, input, len);
-       memset(passwd + len, 0, sizeof(passwd) - len);
+       if (len < sizeof(passwd)) memset(passwd + len, 0, sizeof(passwd) - len);
 
        if (len == 0) {
                len = AUTH_PASS_LEN;