* [PATCH] idmapd: Fix decoding of octal encoded fields.
@ 2011-09-20 18:14 Jan-Marek Glogowski
[not found] ` <alpine.DEB.2.02.1109201952540.26882-icXI/ei3vljFQw+nKBmkQg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jan-Marek Glogowski @ 2011-09-20 18:14 UTC (permalink / raw)
To: linux-nfs
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@fbihome.de>
--- 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-21 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 18:14 [PATCH] idmapd: Fix decoding of octal encoded fields Jan-Marek Glogowski
[not found] ` <alpine.DEB.2.02.1109201952540.26882-icXI/ei3vljFQw+nKBmkQg@public.gmane.org>
2011-09-21 19:40 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).