[Pkg-shadow-commits] r3489 - in upstream/trunk: . libmisc

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun Sep 18 20:40:51 UTC 2011


Author: nekral-guest
Date: 2011-09-18 20:40:50 +0000 (Sun, 18 Sep 2011)
New Revision: 3489

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/salt.c
Log:
	* libmisc/salt.c (SHA_salt_rounds): It is statically ensured that
	the format fits in rounds_prefix.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-09-18 20:26:27 UTC (rev 3488)
+++ upstream/trunk/ChangeLog	2011-09-18 20:40:50 UTC (rev 3489)
@@ -1,5 +1,10 @@
 2011-09-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/salt.c (SHA_salt_rounds): It is statically ensured that
+	the format fits in rounds_prefix.
+
+2011-09-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* src/grpconv.c: Fail if not called correctly.
 	* src/grpconv.c: At the end of main, the passwd and shadow files
 	are locked. No need to check before unlocking. No need to set the
@@ -37,7 +42,7 @@
 	* src/su.c: Too much const were added on 2011-08-15. pw in
 	save_caller_context() is allocated and freed.
 	* src/su.c: Added missing #endif indication
-	* src/su.c save_caller_context(): password only needed if
+	* src/su.c (save_caller_context): password only needed if
 	SU_ACCESS and !USE_PAM.
 
 2011-09-18  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/libmisc/salt.c
===================================================================
--- upstream/trunk/libmisc/salt.c	2011-09-18 20:26:27 UTC (rev 3488)
+++ upstream/trunk/libmisc/salt.c	2011-09-18 20:40:50 UTC (rev 3489)
@@ -106,7 +106,7 @@
  */
 static /*@observer@*/const char *SHA_salt_rounds (/*@null@*/int *prefered_rounds)
 {
-	static char rounds_prefix[18];
+	static char rounds_prefix[18]; /* Max size: rounds=999999999$ */
 	long rounds;
 
 	if (NULL == prefered_rounds) {
@@ -150,14 +150,9 @@
 		rounds = ROUNDS_MAX;
 	}
 
-	(void) snprintf (rounds_prefix, 18, "rounds=%ld$", rounds);
+	(void) snprintf (rounds_prefix, sizeof rounds_prefix,
+	                 "rounds=%ld$", rounds);
 
-	/* Sanity checks. That should not be necessary. */
-	rounds_prefix[17] = '\0';
-	if ('$' != rounds_prefix[16]) {
-		rounds_prefix[17] = '$';
-	}
-
 	return rounds_prefix;
 }
 #endif /* USE_SHA_CRYPT */




More information about the Pkg-shadow-commits mailing list