lkml.org 
[lkml]   [2006]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/3] openpromfs: fix missing NUL

tchars is not '\0'-terminated so the strtoul may run into problems. Fix
that.
Also make tchars as big as a long in hexadecimal form would take rather
than just 16.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>

diff --fast -Ndpru linux-2.6.17-rc4~/fs/openpromfs/inode.c linux-2.6.17-rc4+/fs/openpromfs/inode.c
--- linux-2.6.17-rc4~/fs/openpromfs/inode.c 2006-05-16 20:56:41.395807000 +0200
+++ linux-2.6.17-rc4+/fs/openpromfs/inode.c 2006-05-16 20:57:32.725807000 +0200
@@ -448,10 +448,11 @@ static ssize_t property_write(struct fil
*q |= simple_strtoul (tmp, NULL, 16);
buf += last_cnt;
} else {
- char tchars[17]; /* XXX yuck... */
+ char tchars[2 * sizeof(long) + 1];

- if (copy_from_user(tchars, buf, 16))
+ if (copy_from_user(tchars, buf, sizeof(tchars) - 1))
return -EFAULT;
+ tchars[sizeof(tchars) - 1] = '\0';
*q = simple_strtoul (tchars, NULL, 16);
buf += 9;
}
#<<eof>>
Jan Engelhardt
--
| Software Engineer and Linux/Unix Network Administrator
| Alphagate Systems, http://alphagate.hopto.org/
| jengelh's site, http://jengelh.hopto.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-16 21:20    [W:0.058 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site