bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ui: avoid NULL dereference on realloc failure


From: Jim Meyering
Subject: [PATCH] ui: avoid NULL dereference on realloc failure
Date: Sat, 11 Jul 2009 22:19:09 +0200

I've just pushed this:

>From 1ae256940a86fa000cf768b5fd2dddd7cf6026b2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 26 Jun 2009 17:25:16 +0200
Subject: [PATCH] ui: avoid NULL dereference on realloc failure

* parted/strlist.c (gettext_to_wchar) [ENABLE_NLS]: Use xrealloc,
so we never return NULL, which could then be dereferenced.
---
 parted/strlist.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/parted/strlist.c b/parted/strlist.c
index d71e876..cc4b65c 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -1,6 +1,6 @@
 /*
     parted - a frontend to libparted
-    Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@ gettext_to_wchar (const char* str)
        if (status == (size_t) -1)
                goto error;

-       result = realloc (result, (wcslen (result) + 1) * sizeof (wchar_t));
+       result = xrealloc (result, (wcslen (result) + 1) * sizeof (wchar_t));
        return result;

 error:
--
1.6.3.3.524.g8586b




reply via email to

[Prev in Thread] Current Thread [Next in Thread]