From 88e18ee0d5cbf860ee8bade32d49f9f9253d45ba Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 14 Aug 2016 22:57:31 +0000 Subject: [PATCH] When upcasting to off_t for multiplication, the cast needs to be *before* the multiplication to avoid truncation/overflow ok krw@ --- libexec/ftpd/logutmp.c | 8 ++++---- 1 file 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; } } -- 2.20.1