svn commit: r229184 - stable/9/usr.bin/csup

Dimitry Andric dim at FreeBSD.org
Sun Jan 1 18:42:00 UTC 2012


Author: dim
Date: Sun Jan  1 18:42:00 2012
New Revision: 229184
URL: http://svn.freebsd.org/changeset/base/229184

Log:
  MFC r228625:
  
    In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
    shared secret, and use long long format to snprintf a time_t.
  
  MFC r228626:
  
    In usr.bin/csup/proto.c, use the correct printf length modifier to print
    an off_t.
  
  MFC r228667:
  
    In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the
    corresponding printf length modifier.
  
    Requested by:	mdf

Modified:
  stable/9/usr.bin/csup/auth.c
  stable/9/usr.bin/csup/proto.c
Directory Properties:
  stable/9/usr.bin/csup/   (props changed)

Modified: stable/9/usr.bin/csup/auth.c
==============================================================================
--- stable/9/usr.bin/csup/auth.c	Sun Jan  1 18:36:42 2012	(r229183)
+++ stable/9/usr.bin/csup/auth.c	Sun Jan  1 18:42:00 2012	(r229184)
@@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, 
 	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
 	}
 	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:%jd:%ld:%ld:%d:%d",
+	    inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec,
+	    random(), pid, ppid);
 	MD5_Update(&md5, buf, strlen(buf));
 	MD5_Final(md5sum, &md5);
 	auth_readablesum(md5sum, challenge);

Modified: stable/9/usr.bin/csup/proto.c
==============================================================================
--- stable/9/usr.bin/csup/proto.c	Sun Jan  1 18:36:42 2012	(r229183)
+++ stable/9/usr.bin/csup/proto.c	Sun Jan  1 18:42:00 2012	(r229184)
@@ -35,6 +35,7 @@
 #include <assert.h>
 #include <err.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <netdb.h>
 #include <pthread.h>
 #include <signal.h>
@@ -751,7 +752,7 @@ proto_printf(struct stream *wr, const ch
 			break;
 		case 'O':
 			off = va_arg(ap, off_t);
-			rv = stream_printf(wr, "%llu", off);
+			rv = stream_printf(wr, "%" PRId64, off);
 			break;
 		case 'S':
 			s = va_arg(ap, char *);


More information about the svn-src-stable-9 mailing list