Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105798579
D15119.id47232.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
769 B
Referenced Files
None
Subscribers
None
D15119.id47232.diff
View Options
Index: usr.sbin/chown/chown.c
===================================================================
--- usr.sbin/chown/chown.c
+++ usr.sbin/chown/chown.c
@@ -55,6 +55,7 @@
#include <libgen.h>
#include <pwd.h>
#include <signal.h>
+#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -246,16 +247,13 @@
static uid_t
id(const char *name, const char *type)
{
- uid_t val;
+ unsigned long val;
char *ep;
- /*
- * XXX
- * We know that uid_t's and gid_t's are unsigned longs.
- */
errno = 0;
val = strtoul(name, &ep, 10);
- if (errno || *ep != '\0')
+ _Static_assert(UID_MAX >= GID_MAX, "UID MAX less than GID MAX");
+ if (errno || *ep != '\0' || val > UID_MAX)
errx(1, "%s: illegal %s name", name, type);
return (val);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 8:43 PM (20 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15546572
Default Alt Text
D15119.id47232.diff (769 B)
Attached To
Mode
D15119: Handle overflow of uid or gid in arguments for chown
Attached
Detach File
Event Timeline
Log In to Comment