From: Jeremy Harris Date: Sun, 23 Sep 2018 14:44:15 +0000 (+0100) Subject: Check return from asprintf() X-Git-Tag: exim-4.92-RC1~92 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/5d520e57a9347e0274fdba9e70b7054d38457f96?ds=inline Check return from asprintf() --- diff --git a/src/src/exim_dbutil.c b/src/src/exim_dbutil.c index 17da205b4..a33c59c08 100644 --- a/src/src/exim_dbutil.c +++ b/src/src/exim_dbutil.c @@ -260,8 +260,9 @@ ensures that Exim has exclusive use of the database before it even tries to open it. If there is a database, there should be a lock file in existence. */ #ifdef COMPILE_UTILITY -asprintf(CSS &dirname, "%s/db", spool_directory); -asprintf(CSS &filename, "%s/%s.lockfile", dirname, name); +if ( asprintf(CSS &dirname, "%s/db", spool_directory) < 0 + || asprintf(CSS &filename, "%s/%s.lockfile", dirname, name) < 0) + return NULL; #else dirname = string_sprintf("%s/db", spool_directory); filename = string_sprintf("%s/%s.lockfile", dirname, name); @@ -302,7 +303,7 @@ if (rc < 0) exclusive access to the database, so we can go ahead and open it. */ #ifdef COMPILE_UTILITY -asprintf(CSS &filename, "%s/%s", dirname, name); +if (asprintf(CSS &filename, "%s/%s", dirname, name) < 0) return NULL; #else filename = string_sprintf("%s/%s", dirname, name); #endif