SHA256
1
0
forked from pool/coreutils
coreutils/coreutils-invalid-ids.patch
Bernhard Voelker 681ee7d49f Accepting request 443228 from home:berny:branches:Base:System
- Update to 8.26
  (for details see included NEWS file)
- coreutils.spec (%description): Add b2sum, a new utility.
(BuildRequires): Add timezone to enable new 'date-debug.sh' test.
- coreutils-i18n.patch: Sync I18N patch from Fedora, as the diff
  for the old i18n implementation of expand/unexpand has become
  unmaintainable:
  git://pkgs.fedoraproject.org/coreutils.git
- Remove now-upstream patches:
  * coreutils-df-hash-in-filter.patch
  * coreutils-diagnose-fts-readdir-failure.patch
  * coreutils-m5sum-sha-sum-fix-ignore-missing-with-00-checksums.patch
  * coreutils-maint-fix-dependency-of-man-arch.1.patch
- Refresh/merge all other patches:
  * coreutils-invalid-ids.patch
  * coreutils-ocfs2_reflinks.patch
  * coreutils-remove_hostname_documentation.patch
  * coreutils-remove_kill_documentation.patch
  * coreutils-skip-gnulib-test-tls.patch
  * coreutils-sysinfo.patch
  * coreutils-tests-shorten-extreme-factor-tests.patch

OBS-URL: https://build.opensuse.org/request/show/443228
OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=278
2016-12-02 23:04:18 +00:00

31 lines
980 B
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
+++ src/chgrp.c
@@ -89,7 +89,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))
die (EXIT_FAILURE, 0, _("invalid group: %s"),
quote (name));
gid = tmp;