Re: [PATCH 12/13] sfdisk: fix --unhide segfault

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

 



On Tue, 2014-07-22 at 16:44 -0700, Davidlohr Bueso wrote:
> There's currently a NULL ptr dereference bug when calling asc_to_index()
> via set_unhidden(). Fix this bug by checking the optarg value for null.
> This is similar to how other options handle such calls.
> 
> Before:
> Segmentation fault (core dumped)
> 
> After:
> sfdisk: Done: Success
> 
> Signed-off-by: Davidlohr Bueso <davidlohr@xxxxxx>
> ---
>  disk-utils/sfdisk.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
> index 86ed112..f730504 100644
> --- a/disk-utils/sfdisk.c
> +++ b/disk-utils/sfdisk.c
> @@ -2909,12 +2909,13 @@ static int do_activate(char **av, int ac, char *arg)
>  	return ret;
>  }
>  
> -static void
> -set_unhidden(struct disk_desc *z, char *pnam) {
> +static void set_unhidden(struct disk_desc *z, char *pnam)
> +{
>  	int pno;
>  	unsigned char id;
>  
>  	pno = asc_to_index(pnam, z);
> +	printf("\t%s\n", pnam);

err, sorry... forgot to delete that one.

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux