diff options
-rw-r--r-- | usr.bin/csup/auth.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/csup/auth.c b/usr.bin/csup/auth.c index f24cd00..516be70 100644 --- a/usr.bin/csup/auth.c +++ b/usr.bin/csup/auth.c @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, char *secret) MD5_Update(&md5, ":", 1); MD5_Update(&md5, auth->password, strlen(auth->password)); MD5_Final(md5sum, &md5); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, MD5_CHARS_MAX); strcpy(secret, md5salt); auth_readablesum(md5sum, secret + strlen(md5salt)); } @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config, char *challenge) } gettimeofday(&tv, NULL); MD5_Init(&md5); - snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", - inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid); + snprintf(buf, sizeof(buf), "%s:%lld:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec, + random(), pid, ppid); MD5_Update(&md5, buf, strlen(buf)); MD5_Final(md5sum, &md5); auth_readablesum(md5sum, challenge); |