diff options
author | wangyufen <wangyufen@huawei.com> | 2014-11-11 15:59:11 +0800 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2014-12-10 13:05:58 -0600 |
commit | 0cda37ffaf3cb7aec2c1c8b49e2a5b8f82255c3e (patch) | |
tree | 0ac34147c8f71f35dbf53b97541aa7ba4b8b9925 | |
parent | 86087816201d61f1b72d8bd7d91cfc7eb26422e9 (diff) |
add argument check in mknod
mknod() in glibc/eglibc will check the argument, like this,
...
if (k_dev != dev) {
__set_errno (EINVAL);
return -1;
}
...
So add argument check in uclibc's mknod() too.
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
-rw-r--r-- | libc/sysdeps/linux/common/mknod.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/mknod.c b/libc/sysdeps/linux/common/mknod.c index 416cab6d0..794e19f57 100644 --- a/libc/sysdeps/linux/common/mknod.c +++ b/libc/sysdeps/linux/common/mknod.c @@ -24,6 +24,10 @@ int mknod(const char *path, mode_t mode, dev_t dev) /* We must convert the value to dev_t type used by the kernel. */ k_dev = (dev) & ((1ULL << 32) - 1); + if (k_dev != dev) { + __set_errno (EINVAL); + return -1; + } return INLINE_SYSCALL(mknod, 3, path, mode, (unsigned int)k_dev); } #endif |