[Pkg-shadow-commits] r3321 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Jun 2 20:26:31 UTC 2011


Author: nekral-guest
Date: 2011-06-02 20:26:30 +0000 (Thu, 02 Jun 2011)
New Revision: 3321

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/faillog.c
   upstream/trunk/src/lastlog.c
Log:
	* src/lastlog.c, src/faillog.c: Fix underflows causing wrong entry
	to be displayed.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2011-06-02 18:41:05 UTC (rev 3320)
+++ upstream/trunk/ChangeLog	2011-06-02 20:26:30 UTC (rev 3321)
@@ -1,3 +1,8 @@
+2011-06-02  Peter Vrabec  <pvrabec at redhat.com>
+
+	* src/lastlog.c, src/faillog.c: Fix underflows causing wrong entry
+	to be displayed.
+
 2011-06-02  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* libmisc/xmalloc.c: Harmonize message.

Modified: upstream/trunk/src/faillog.c
===================================================================
--- upstream/trunk/src/faillog.c	2011-06-02 18:41:05 UTC (rev 3320)
+++ upstream/trunk/src/faillog.c	2011-06-02 20:26:30 UTC (rev 3321)
@@ -118,8 +118,8 @@
 		return;
 	}
 
-	offset = pw->pw_uid * sizeof (fl);
-	if (offset <= (statbuf.st_size - sizeof (fl))) {
+	offset = (off_t) pw->pw_uid * sizeof (fl);
+	if (offset + sizeof (fl) <= statbuf.st_size) {
 		/* fseeko errors are not really relevant for us. */
 		int err = fseeko (fail, offset, SEEK_SET);
 		assert (0 == err);
@@ -218,8 +218,8 @@
 	off_t offset;
 	struct faillog fl;
 
-	offset = uid * sizeof (fl);
-	if (offset <= (statbuf.st_size - sizeof (fl))) {
+	offset = (off_t) uid * sizeof (fl);
+	if (offset + sizeof (fl) <= statbuf.st_size) {
 		/* fseeko errors are not really relevant for us. */
 		int err = fseeko (fail, offset, SEEK_SET);
 		assert (0 == err);
@@ -333,7 +333,7 @@
 	struct faillog fl;
 
 	offset = (off_t) uid * sizeof (fl);
-	if (offset <= (statbuf.st_size - sizeof (fl))) {
+	if (offset + sizeof (fl) <= statbuf.st_size) {
 		/* fseeko errors are not really relevant for us. */
 		int err = fseeko (fail, offset, SEEK_SET);
 		assert (0 == err);
@@ -450,7 +450,7 @@
 	struct faillog fl;
 
 	offset = (off_t) uid * sizeof (fl);
-	if (offset <= (statbuf.st_size - sizeof (fl))) {
+	if (offset + sizeof (fl) <= statbuf.st_size) {
 		/* fseeko errors are not really relevant for us. */
 		int err = fseeko (fail, offset, SEEK_SET);
 		assert (0 == err);

Modified: upstream/trunk/src/lastlog.c
===================================================================
--- upstream/trunk/src/lastlog.c	2011-06-02 18:41:05 UTC (rev 3320)
+++ upstream/trunk/src/lastlog.c	2011-06-02 20:26:30 UTC (rev 3321)
@@ -102,9 +102,8 @@
 	}
 
 
-	offset = pw->pw_uid * sizeof (ll);
-
-	if (offset <= (statbuf.st_size - sizeof (ll))) {
+	offset = (off_t) pw->pw_uid * sizeof (ll);
+	if (offset + sizeof (ll) <= statbuf.st_size) {
 		/* fseeko errors are not really relevant for us. */
 		int err = fseeko (lastlogfile, offset, SEEK_SET);
 		assert (0 == err);




More information about the Pkg-shadow-commits mailing list