summaryrefslogtreecommitdiffstats
path: root/lib/librpcsvc
diff options
context:
space:
mode:
authormatteo <matteo@FreeBSD.org>2008-02-04 07:56:36 +0000
committermatteo <matteo@FreeBSD.org>2008-02-04 07:56:36 +0000
commit5f3ef8ab8cf6ae2bfece834a1a6ee713b066a38e (patch)
tree078b1c1eb80b51085c6ca311791d0ed08fa2e3d8 /lib/librpcsvc
parentd1d4a209f5bd9e9ec6d5ba292c64bd21e8f9248b (diff)
downloadFreeBSD-src-5f3ef8ab8cf6ae2bfece834a1a6ee713b066a38e.zip
FreeBSD-src-5f3ef8ab8cf6ae2bfece834a1a6ee713b066a38e.tar.gz
Fix incorrect handling of malloc failures
PR: bin/83369 MFC after: 1 week
Diffstat (limited to 'lib/librpcsvc')
-rw-r--r--lib/librpcsvc/Makefile2
-rw-r--r--lib/librpcsvc/xcrypt.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/librpcsvc/Makefile b/lib/librpcsvc/Makefile
index 3939a6a..c9674cb 100644
--- a/lib/librpcsvc/Makefile
+++ b/lib/librpcsvc/Makefile
@@ -29,6 +29,8 @@ SRCS+= ${GENSRCS} ${OTHERSRCS} ${SECRPCSRCS}
CLEANFILES+= ${GENSRCS}
+WARNS?= 2
+
.include <bsd.lib.mk>
.SUFFIXES: .x _xdr.c
diff --git a/lib/librpcsvc/xcrypt.c b/lib/librpcsvc/xcrypt.c
index ed6cbef..7a310d3 100644
--- a/lib/librpcsvc/xcrypt.c
+++ b/lib/librpcsvc/xcrypt.c
@@ -67,7 +67,9 @@ xencrypt(secret, passwd)
int len;
len = strlen(secret) / 2;
- buf = malloc((unsigned)len);
+ if ((buf = malloc((unsigned)len)) == NULL) {
+ return(0);
+ }
hex2bin(len, secret, buf);
passwd2des(passwd, key);
@@ -100,7 +102,9 @@ xdecrypt(secret, passwd)
int len;
len = strlen(secret) / 2;
- buf = malloc((unsigned)len);
+ if ((buf = malloc((unsigned)len)) == NULL) {
+ return(0);
+ }
hex2bin(len, secret, buf);
passwd2des(passwd, key);
OpenPOWER on IntegriCloud