~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: 2009-03-01 04:12:00 UTC
  • mfrom: (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20090301041200-lpy48neihwf128p9
Tags: 264-2
Build-Depend on quilt

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);