Re: [PATCH] idmapd: Fix decoding of octal encoded fields.

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

 




On 09/20/2011 02:14 PM, Jan-Marek Glogowski wrote:
> The decoded octal will always be positive and (char) -1 is negative. Any field containing an encoded octal will be rejected.
> 
> As the encoded value should be an unsigned char, fix the check to reject all values > (unsigned char) -1 = UCHAR_MAX, as this indicate an error in the encoding.
> 
> Signed-off-by: Jan-Marek Glogowski <glogow@xxxxxxxxxx>
Committed..

steved.

> 
> --- nfs-utils-1.2.4.orig/utils/idmapd/idmapd.c
> +++ nfs-utils-1.2.4/utils/idmapd/idmapd.c
> @@ -925,9 +925,9 @@ getfield(char **bpp, char *fld, size_t f
>          if (*bp == '\\') {
>              if ((n = sscanf(bp, "\\%03o", &val)) != 1)
>                  return (-1);
> -            if (val > (char)-1)
> +            if (val > UCHAR_MAX)
>                  return (-1);
> -            *fld++ = (char)val;
> +            *fld++ = val;
>              bp += 4;
>          } else {
>              *fld++ = *bp;
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux