Whamcloud - gitweb
ostype.c (e2p_os2string): Check to make sure malloc() is
authorTheodore Ts'o <tytso@mit.edu>
Thu, 31 Mar 2005 05:01:33 +0000 (00:01 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 31 Mar 2005 05:01:33 +0000 (00:01 -0500)
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)

lib/e2p/ChangeLog
lib/e2p/ostype.c

index 1e40bb4..68a8379 100644 (file)
@@ -1,3 +1,10 @@
+2005-03-30  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.37
index fe6597d..826e080 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "e2p.h"
 #include <string.h>
+#include <stdlib.h>
 
 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;
 }