grub-devel
[Top][All Lists]
Advanced

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

Re: strndup broken


From: Hollis Blanchard
Subject: Re: strndup broken
Date: Fri, 21 Jan 2005 23:38:11 -0600

On Jan 21, 2005, at 2:19 PM, Marco Gerards wrote:

Hollis Blanchard <address@hidden> writes:

A while back I made the unpleasent discovery that grub_strndup was
broken. This patch fixes it, but the author has been having trouble
sending it out.

Because of copyright problems (Ian did not assign his copyrights yet)
and especially because the old function was just plain wrong I have
rewritten it.

Can you check if it works for you?  If I don't hear anything I will
commit it next week or so.

This exposed a stupid bug I introduced months ago:

--- disk/powerpc/ieee1275/ofdisk.c 27 Dec 2004 13:46:20 -0000 1.6
+++ disk/powerpc/ieee1275/ofdisk.c      22 Jan 2005 05:37:16 -0000
@@ -50,12 +50,12 @@ grub_ofdisk_open (const char *name, grub
 {
   grub_ieee1275_phandle_t dev;
   grub_ieee1275_ihandle_t dev_ihandle = 0;
-  char *devpath = 0;
+  char *devpath;
   /* XXX: This should be large enough for any possible case.  */
   char prop[64];
   int actual;

-  devpath = grub_strndup (name, grub_strlen (devpath) + 2);
+  devpath = grub_strndup (name, grub_strlen (name) + 2);
   if (! devpath)
     return grub_errno;

`devpath' is clearly NULL here.

I think it's in all our best interests to get a working strndup in soon. :)

-Hollis





reply via email to

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