From 813b901d419cd700cf2fc65048142b024da49808 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 31 Mar 2005 00:01:33 -0500 Subject: [PATCH] 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) --- lib/e2p/ChangeLog | 7 +++++++ lib/e2p/ostype.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/e2p/ChangeLog b/lib/e2p/ChangeLog index 1e40bb4..68a8379 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 fe6597d..826e080 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; } -- 1.8.3.1