summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-08-14 22:57:31 +0000
committerguenther <guenther@openbsd.org>2016-08-14 22:57:31 +0000
commit88e18ee0d5cbf860ee8bade32d49f9f9253d45ba (patch)
treef98d9befb61967b65ea7d4a27c2372f1f0639653
parentConvert %q to %ll with long long casts for printf() (diff)
downloadwireguard-openbsd-88e18ee0d5cbf860ee8bade32d49f9f9253d45ba.tar.xz
wireguard-openbsd-88e18ee0d5cbf860ee8bade32d49f9f9253d45ba.zip
When upcasting to off_t for multiplication, the cast needs to be *before*
the multiplication to avoid truncation/overflow ok krw@
-rw-r--r--libexec/ftpd/logutmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libexec/ftpd/logutmp.c b/libexec/ftpd/logutmp.c
index 4b14998feb6..d0c86ef0151 100644
--- a/libexec/ftpd/logutmp.c
+++ b/libexec/ftpd/logutmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logutmp.c,v 1.12 2014/10/25 03:19:22 lteo Exp $ */
+/* $OpenBSD: logutmp.c,v 1.13 2016/08/14 22:57:31 guenther Exp $ */
/*
* Portions Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -76,7 +76,7 @@ ftpd_login(struct utmp *ut)
/*
* Now find a slot that's not in use...
*/
- (void)lseek(fd, (off_t)(topslot * sizeof(struct utmp)), SEEK_SET);
+ (void)lseek(fd, (off_t)topslot * sizeof(struct utmp), SEEK_SET);
while (1) {
if (read(fd, &ubuf, sizeof(struct utmp)) ==
@@ -88,8 +88,8 @@ ftpd_login(struct utmp *ut)
}
topslot++;
} else {
- (void)lseek(fd, (off_t)(topslot *
- sizeof(struct utmp)), SEEK_SET);
+ (void)lseek(fd, (off_t)topslot * sizeof(struct utmp),
+ SEEK_SET);
break;
}
}