idmapd: Fix decoding of octal encoded fields.
Subsystems (2)
PATCH 1/1 idmapd: Fix decoding of octal encoded fields.
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 <[email protected]>
utils/idmapd/idmapd.c +2 -2
@@ -925,9 +925,9 @@ getfield(char **bpp, char *fld, size_t fif (*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;
Quoted 5 lines · Jan-Marek Glogowski
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 <[email protected]>
Committed..
steved.
Quoted 19 lines
utils/idmapd/idmapd.c +2
-2@@ -925,9 +925,9 @@ getfield(char **bpp, char *fld, size_t fif (*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;Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html