From 2a29b52b9839e020190e2f5c5070f238e279e855 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 30 Jun 1998 17:21:48 +0000 Subject: [PATCH] Fixed scanf format errors. The error handling is not quite bug for bug compatible. I think small negative uids are handled compatibly but other out of bounds ones are truncated differently for certain sizes of uid_t. --- lib/libc/rpc/netnamer.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c index 41c514625a9..26e58b02c3d 100644 --- a/lib/libc/rpc/netnamer.c +++ b/lib/libc/rpc/netnamer.c @@ -76,6 +76,7 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) char *p; int gidlen; uid_t uid; + long luid; struct passwd *pwd; char val[1024]; char *val1, *val2; @@ -126,14 +127,10 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist) if (strcmp(val2 + 1, domain)) return (0); /* wrong domain */ - /* XXX: uid_t have different sizes on different OS's. sigh! */ - if (sizeof (uid_t) == sizeof (short)) { - if (sscanf(val, "%hd", (short *)&uid) != 1) - return (0); - } else { - if (sscanf(val, "%ld", &uid) != 1) + if (sscanf(val, "%ld", &luid) != 1) return (0); - } + uid = luid; + /* use initgroups method */ pwd = getpwuid(uid); if (pwd == NULL) -- 2.45.2