forked from pool/coreutils
6f150a9022
- Add upstream patch (coreutils-copy-fix-selinux-existing-dirs.patch): cp -a: set the correct SELinux context on already existing destination directories (rh#1045122). - Merge I18n fixes from Fedora (coreutils-i18n.patch): * sort: fix sorting by non-first field (rh#1003544) * cut: avoid using slower multi-byte code in non-UTF-8 locales (rh#1021403, rh#499220). - Testsuite: skip some tests: * coreutils-skip-some-sort-tests-on-ppc.patch: Add patch to skip 2 valgrind'ed sort tests on ppc/ppc64. * coreutils-skip-gnulib-test-tls.patch: Add patch to skip the gnulib test 'test-tls' on i586, x86_64, ppc and ppc64. * coreutils-tests-avoid-FP-cp-cpuinfo.patch: Add patch to skip a test when cp fails for /proc/cpuinfo which happens on aarch64. * coreutils-tests-shorten-extreme-factor-tests.patch: Add patch to skip most of the extreme-expensive factor tests. OBS-URL: https://build.opensuse.org/request/show/213254 OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=221
31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
While uid_t and gid_t are both unsigned, the values (uid_t) -1 and
|
|
(gid_t) -1 are reserved. A uid or gid argument of -1 to the chown(2)
|
|
system call means to leave the uid/gid unchanged. Catch this case
|
|
so that trying to set a uid or gid to -1 will result in an error.
|
|
|
|
Test cases:
|
|
|
|
chown 4294967295 file
|
|
chown :4294967295 file
|
|
chgrp 4294967295 file
|
|
|
|
Andreas Gruenbacher <agruen@suse.de>
|
|
|
|
---
|
|
src/chgrp.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
Index: src/chgrp.c
|
|
===================================================================
|
|
--- src/chgrp.c.orig 2013-12-04 15:48:30.000000000 +0100
|
|
+++ src/chgrp.c 2014-01-09 01:26:29.066362326 +0100
|
|
@@ -88,7 +88,7 @@ parse_group (const char *name)
|
|
{
|
|
unsigned long int tmp;
|
|
if (! (xstrtoul (name, NULL, 10, &tmp, "") == LONGINT_OK
|
|
- && tmp <= GID_T_MAX))
|
|
+ && tmp <= GID_T_MAX && (gid_t) tmp != (gid_t) -1))
|
|
error (EXIT_FAILURE, 0, _("invalid group: %s"), quote (name));
|
|
gid = tmp;
|
|
}
|