Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jan 2002 22:31:21 +0300
From:      "Andrey A. Chernov" <ache@nagual.pp.ru>
To:        markm@freebsd.org, des@freebsd.org, current@freebsd.org
Subject:   Step3, pam_opie snprintf bloat fix for review
Message-ID:  <20020120193121.GA23954@nagual.pp.ru>

next in thread | raw e-mail | index | archive | help
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.

--- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020120193121.GA23954>