From: Todd C. Miller Date: Sun, 23 Jul 1995 21:48:30 +0000 (+0000) Subject: now uses MAX_UID_T_LEN X-Git-Tag: SUDO_1_4_0~265 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e70f526da54483e2ab96df84706579f2faba90cf;p=sudo now uses MAX_UID_T_LEN --- diff --git a/sudo.c b/sudo.c index 0ce406974..c8ffad0b8 100644 --- a/sudo.c +++ b/sudo.c @@ -737,21 +737,16 @@ void set_perms(perm) static char *uid2str(uid) uid_t uid; { - int len; - unsigned n; char *uidstr; - for (len = 1, n = (unsigned) uid; (unsigned) (n = n / 10) != 0; ) - ++len; - - uidstr = (char *) malloc(len+1); + uidstr = (char *) malloc(MAX_UID_T_LEN + 1); if (uidstr == NULL) { perror("malloc"); (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1); } - (void) sprintf(uidstr, "%u", (unsigned) uid); + (void) sprintf(uidstr, "%ld", uid); return(uidstr); }