[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix using freed memory for long option arguments
From: |
Pavel Roskin |
Subject: |
Re: [PATCH] Fix using freed memory for long option arguments |
Date: |
Tue, 07 Jul 2009 15:55:26 -0400 |
On Mon, 2009-07-06 at 19:43 -0400, Pavel Roskin wrote:
> - if (opt->longarg && ! grub_strcmp (opt->longarg, s))
> + if (opt->longarg && ! grub_strncmp (opt->longarg, s, len))
This change has an unexpected side effect, as GRUB starts recognizing
abbreviated options (like --fs instead of --fs-uuid). But it would be
wrong to add features in a patch that fixes bug. Besides, proper
support for abbreviations should check that the abbreviation is unique.
If it's not, only exact matches should be allowed.
So I'm changing it to:
if (opt->longarg && ! grub_strncmp (opt->longarg, s, len) &&
opt->longarg[len] == '\0')
Committed now.
--
Regards,
Pavel Roskin