From: Theodore Ts'o Date: Thu, 31 Mar 2005 05:01:33 +0000 (-0500) Subject: ostype.c (e2p_os2string): Check to make sure malloc() is X-Git-Tag: E2FSPROGS-1_38-WIP-0509~37 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=813b901d419cd700cf2fc65048142b024da49808;p=thirdparty%2Fe2fsprogs.git ostype.c (e2p_os2string): Check to make sure malloc() is successful before attempting to copy into it. Add #include of stdlib.h to fix a core dump bug on the IA64 architecture. (Addresses Debian Bug #302200) --- diff --git a/lib/e2p/ChangeLog b/lib/e2p/ChangeLog index 1e40bb404..68a837990 100644 --- a/lib/e2p/ChangeLog +++ b/lib/e2p/ChangeLog @@ -1,3 +1,10 @@ +2005-03-30 Theodore Ts'o + + * ostype.c (e2p_os2string): Check to make sure malloc() is + successful before attempting to copy into it. Add + #include of stdlib.h to fix a core dump bug on the IA64 + architecture. (Addresses Debian Bug #302200) + 2005-03-21 Theodore Ts'o * Release of E2fsprogs 1.37 diff --git a/lib/e2p/ostype.c b/lib/e2p/ostype.c index fe6597dd5..826e080f7 100644 --- a/lib/e2p/ostype.c +++ b/lib/e2p/ostype.c @@ -9,6 +9,7 @@ #include "e2p.h" #include +#include const char *os_tab[] = { "Linux", @@ -32,7 +33,8 @@ char *e2p_os2string(int os_type) os = "(unknown os)"; ret = malloc(strlen(os)+1); - strcpy(ret, os); + if (ret) + strcpy(ret, os); return ret; }