From: Theodore Ts'o Date: Wed, 22 Dec 2004 05:49:06 +0000 (-0500) Subject: In fsck, check return from malloc of fsck_path, and print an error message X-Git-Tag: E2FSPROGS-1_36~98 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=c88bce8df0ecf511b0c63de6292f215d562860a2;p=tools%2Fe2fsprogs.git In fsck, check return from malloc of fsck_path, and print an error message if it fails. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 9797529..9c9d83d 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,7 @@ +2004-12-22 Theodore Ts'o + + * fsck.c (main): Check return from malloc of fsck_path string. + 2004-12-21 Theodore Ts'o * tune2fs.c (parse_time): Fix minor buglet; the parse_time routine diff --git a/misc/fsck.c b/misc/fsck.c index da85867..b1e286a 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -1221,6 +1221,10 @@ int main(int argc, char *argv[]) if (oldpath) { fsck_path = malloc (strlen (fsck_prefix_path) + 1 + strlen (oldpath) + 1); + if (!fsck_path) { + fprintf(stderr, "%s: Unable to allocate memory for fsck_path\n", progname); + exit(EXIT_ERROR); + } strcpy (fsck_path, fsck_prefix_path); strcat (fsck_path, ":"); strcat (fsck_path, oldpath);