From: Alex Hornung Date: Fri, 17 Jun 2011 23:05:57 +0000 (+0100) Subject: cryptdisks - Add retval checks for popen and alloc X-Git-Tag: v2.12.0~448 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/44053572393185f2479540928f8f954712d842dc cryptdisks - Add retval checks for popen and alloc --- diff --git a/sbin/cryptdisks/cryptdisks.c b/sbin/cryptdisks/cryptdisks.c index b778218c87..58ab16b04b 100644 --- a/sbin/cryptdisks/cryptdisks.c +++ b/sbin/cryptdisks/cryptdisks.c @@ -222,8 +222,15 @@ parse_crypt_options(struct crypt_options *co, char *option) /* Allocate safe key memory */ buf = alloc_safe_mem(8192); + if (buf == NULL) + err(1, "Could not allocate safe memory"); + /* NOTREACHED */ fd = popen(parameter, "r"); + if (fd == NULL) + syntax_error("The 'keyscript' file could not be run"); + /* NOTREACHED */ + if ((fread(buf, 1, sizeof(buf), fd)) == 0) syntax_error("The 'keyscript' program failed"); /* NOTREACHED */