瀏覽代碼

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>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wang Yufen 10 年之前
父節點
當前提交
e55f589191
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      libc/sysdeps/linux/common/mknod.c

+ 4 - 0
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