summaryrefslogtreecommitdiff
path: root/security/nss/cmd
diff options
context:
space:
mode:
authorjulien.pierre.bugs%sun.com <devnull@localhost>2005-02-26 04:57:32 +0000
committerjulien.pierre.bugs%sun.com <devnull@localhost>2005-02-26 04:57:32 +0000
commit0d59e634c26d57b37b17c78ae75e74938d2292bf (patch)
treed903bbc7a20208b55550d05f4f6df0a26e8dc221 /security/nss/cmd
parent45345850e057532ed4c7115b4412d3f9b2622416 (diff)
downloadnss-hg-0d59e634c26d57b37b17c78ae75e74938d2292bf.tar.gz
Fix for bug 283761 - use of memset in selfserv is inefficient. r=nelson
Diffstat (limited to 'security/nss/cmd')
-rw-r--r--security/nss/cmd/selfserv/selfserv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/security/nss/cmd/selfserv/selfserv.c b/security/nss/cmd/selfserv/selfserv.c
index 7bb93cbbc..458da225d 100644
--- a/security/nss/cmd/selfserv/selfserv.c
+++ b/security/nss/cmd/selfserv/selfserv.c
@@ -847,7 +847,6 @@ handle_connection(
pBuf = buf;
bufRem = sizeof buf;
- memset(buf, 0, sizeof buf);
VLOG(("selfserv: handle_connection: starting"));
opt.option = PR_SockOpt_Nonblocking;
@@ -887,7 +886,7 @@ handle_connection(
while (1) {
newln = 0;
reqLen = 0;
- rv = PR_Read(ssl_sock, pBuf, bufRem);
+ rv = PR_Read(ssl_sock, pBuf, bufRem - 1);
if (rv == 0 ||
(rv < 0 && PR_END_OF_FILE_ERROR == PR_GetError())) {
if (verbose)
@@ -898,6 +897,8 @@ handle_connection(
errWarn("HDX PR_Read");
goto cleanup;
}
+ /* NULL termination */
+ pBuf[rv] = 0;
if (firstTime) {
firstTime = 0;
printSecurityInfo(ssl_sock);