summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libudev/libudev-util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 0f20e58586..2c31d5b1db 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -87,8 +87,11 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
struct passwd *pw;
uid_t uid;
size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
- char *buf = alloca(buflen);
+ char *buf;
+ if (buflen == -1)
+ buflen = 1024;
+ buf = alloca(buflen);
if (streq(user, "root"))
return 0;
uid = strtoul(user, &endptr, 10);
@@ -114,6 +117,8 @@ gid_t util_lookup_group(struct udev *udev, const char *group)
size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
char *buf = NULL;
+ if (buflen == -1)
+ buflen = 1024;
if (streq(group, "root"))
return 0;
gid = strtoul(group, &endptr, 10);