~ubuntu-branches/ubuntu/trusty/libnss-ldap/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/00uid_t.patch

  • Committer: Bazaar Package Importer
  • Author(s): Richard A Nelson (Rick)
  • Date: 2007-05-14 19:40:00 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070514194000-40u9ndh540lgliqe
Tags: 255-1
Survived i386 and amd64, let it loose

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# * Fixed possible overflow in uid/gid handling, Closes: #354093
 
2
--- libnss-ldap-255.orig/ldap-pwd.c
 
3
+++ libnss-ldap-255/ldap-pwd.c
 
4
@@ -86,9 +86,11 @@
 
5
   struct passwd *pw = (struct passwd *) result;
 
6
   char *uid, *gid;
 
7
   NSS_STATUS stat;
 
8
-  char tmpbuf[sizeof "-4294967295"];
 
9
+  char tmpbuf[ sizeof( uid_t ) * 8 / 3 + 2 ];
 
10
   size_t tmplen;
 
11
   char *tmp;
 
12
+  
 
13
+  tmpbuf[ sizeof(tmpbuf) - 1 ] = '\0';
 
14
 
 
15
   if (_nss_ldap_oc_check (e, "shadowAccount") == NSS_SUCCESS)
 
16
     {
 
17
@@ -117,7 +119,7 @@
 
18
     return stat;
 
19
 
 
20
   tmp = tmpbuf;
 
21
-  tmplen = sizeof (tmpbuf);
 
22
+  tmplen = sizeof (tmpbuf) - 1;
 
23
   stat =
 
24
     _nss_ldap_assign_attrval (e, AT (uidNumber), &uid, &tmp, &tmplen);
 
25
   if (stat != NSS_SUCCESS)
 
26
@@ -125,7 +127,7 @@
 
27
   pw->pw_uid = (*uid == '\0') ? UID_NOBODY : (uid_t) atol (uid);
 
28
 
 
29
   tmp = tmpbuf;
 
30
-  tmplen = sizeof (tmpbuf);
 
31
+  tmplen = sizeof (tmpbuf) - 1;
 
32
   stat =
 
33
     _nss_ldap_assign_attrval (e, ATM (LM_PASSWD, gidNumber), &gid, &tmp,
 
34
                               &tmplen);