Messages in this thread Patch in this message | | | Date | Tue, 16 May 2006 21:18:18 +0200 (MEST) | From | Jan Engelhardt <> | 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/
| |