Re: [PATCH] Fix parsing numeric color values

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

 



Timo Hirvonen <tihirvon@xxxxxxxxx> writes:

> Fix bug reported by Chris Larson <clarson@xxxxxxxxxxx>.  Numeric color
> only worked if it was at end of line.

Signoff?

It is much easier to read if you said that backwards:

        Numeric color only worked if it was at end of line.
        Noticed by Chris Larson <clarson@xxxxxxxxxxx>.  

> @@ -17,7 +17,7 @@ static int parse_color(const char *name, int len)
>  			return i - 1;
>  	}
>  	i = strtol(name, &end, 10);
> -	if (*name && !*end && i >= -1 && i <= 255)
> +	if (*name && (!*end || isspace(*end)) && i >= -1 && i <= 255)

Hmph.  Is it the same as (end-name) == len?

Please add a test so that your fix won't be broken by others who
might later touch this code.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux