From owner-freebsd-current Sun Jan 20 12: 4:46 2002 Delivered-To: freebsd-current@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 8389237B405; Sun, 20 Jan 2002 12:04:37 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g0KK4Vd89909; Sun, 20 Jan 2002 20:04:31 GMT (envelope-from mark@grondar.za) Received: from grondar.za (mark@localhost [127.0.0.1]) by grimreaper.grondar.org (8.11.6/8.11.6) with ESMTP id g0KK0at32884; Sun, 20 Jan 2002 20:00:36 GMT (envelope-from mark@grondar.za) Message-Id: <200201202000.g0KK0at32884@grimreaper.grondar.org> To: "Andrey A. Chernov" Cc: markm@FreeBSD.ORG, des@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: Step3, pam_opie snprintf bloat fix for review References: <20020120193121.GA23954@nagual.pp.ru> In-Reply-To: <20020120193121.GA23954@nagual.pp.ru> ; from "Andrey A. Chernov" "Sun, 20 Jan 2002 22:31:21 +0300." Date: Sun, 20 Jan 2002 20:00:36 +0000 From: Mark Murray Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Bug: > snprintf is large and slow, increasing program size and slowing it down. > Better way is avoid snprintf when it is not neccessary. > > Fix: > Full functionality of snprintf is not needed below, so it is replaced by > much faster strlcpy. This is fine! Style - please make it 'sizeof(foo)', not 'sizeof foo'. M > --- pam_opie.c.bak Sat Jan 19 21:29:49 2002 > +++ pam_opie.c Sun Jan 20 22:23:18 2002 > @@ -125,7 +125,7 @@ > } > > /* We have to copy the response, because opieverify mucks with it. */ > - snprintf(resp, sizeof resp, "%s", response); > + strlcpy(resp, response, sizeof resp); > > /* > * Opieverify is supposed to return -1 only if an error occurs. > -- > Andrey A. Chernov > http://ache.pp.ru/ > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message -- o Mark Murray \_ FreeBSD Services Limited O.\_ Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message