Fix incorrect handling of malloc failures
PR: bin/83369 MFC after: 1 week
This commit is contained in:
parent
b42024b241
commit
c75cd2cb75
@ -29,6 +29,8 @@ SRCS+= ${GENSRCS} ${OTHERSRCS} ${SECRPCSRCS}
|
||||
|
||||
CLEANFILES+= ${GENSRCS}
|
||||
|
||||
WARNS?= 2
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
.SUFFIXES: .x _xdr.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);
|
||||
|
Loading…
Reference in New Issue
Block a user