瀏覽代碼

coroparse: Do not convert empty uid, gid to 0

When uid (or gid) value was empty string it was incorrectly converted to
0. Solution is to check input string emptines.

Thanks Bin Liu <bliu@suse.com> for reporting the bug.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Bin Liu <bliu@suse.com>
(cherry picked from commit f05d1c9293133c398bd06a16b9fc7bfbfb2a21e8)
Jan Friesse 8 年之前
父節點
當前提交
6096ef32c9
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      exec/coroparse.c

+ 2 - 2
exec/coroparse.c

@@ -140,7 +140,7 @@ static int uid_determine (const char *req_user)
 	char *ep;
 
 	id = strtol(req_user, &ep, 10);
-	if (*ep == '\0' && id >= 0 && id <= UINT_MAX) {
+	if (*req_user != '\0' && *ep == '\0' && id >= 0 && id <= UINT_MAX) {
 		return (id);
 	}
 
@@ -194,7 +194,7 @@ static int gid_determine (const char *req_group)
 	char *ep;
 
 	id = strtol(req_group, &ep, 10);
-	if (*ep == '\0' && id >= 0 && id <= UINT_MAX) {
+	if (*req_group != '\0' && *ep == '\0' && id >= 0 && id <= UINT_MAX) {
 		return (id);
 	}