]> granicus.if.org Git - sudo/commitdiff
now uses MAX_UID_T_LEN
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 23 Jul 1995 21:48:30 +0000 (21:48 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 23 Jul 1995 21:48:30 +0000 (21:48 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index 0ce40697448044c3e6ea68ace9a5bab1e1b51c63..c8ffad0b8df1fb387c8057a0d1c3b42e075bce8f 100644 (file)
--- 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);
 }