Fix incorrect handling of malloc failures
PR: bin/83369 MFC after: 1 week
This commit is contained in:
parent
b42024b241
commit
c75cd2cb75
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175965
@ -29,6 +29,8 @@ SRCS+= ${GENSRCS} ${OTHERSRCS} ${SECRPCSRCS}
|
|||||||
|
|
||||||
CLEANFILES+= ${GENSRCS}
|
CLEANFILES+= ${GENSRCS}
|
||||||
|
|
||||||
|
WARNS?= 2
|
||||||
|
|
||||||
.include <bsd.lib.mk>
|
.include <bsd.lib.mk>
|
||||||
|
|
||||||
.SUFFIXES: .x _xdr.c
|
.SUFFIXES: .x _xdr.c
|
||||||
|
@ -67,7 +67,9 @@ xencrypt(secret, passwd)
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = strlen(secret) / 2;
|
len = strlen(secret) / 2;
|
||||||
buf = malloc((unsigned)len);
|
if ((buf = malloc((unsigned)len)) == NULL) {
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
hex2bin(len, secret, buf);
|
hex2bin(len, secret, buf);
|
||||||
passwd2des(passwd, key);
|
passwd2des(passwd, key);
|
||||||
@ -100,7 +102,9 @@ xdecrypt(secret, passwd)
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = strlen(secret) / 2;
|
len = strlen(secret) / 2;
|
||||||
buf = malloc((unsigned)len);
|
if ((buf = malloc((unsigned)len)) == NULL) {
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
hex2bin(len, secret, buf);
|
hex2bin(len, secret, buf);
|
||||||
passwd2des(passwd, key);
|
passwd2des(passwd, key);
|
||||||
|
Loading…
Reference in New Issue
Block a user