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
5
struct passwd *pw = (struct passwd *) result;
8
- char tmpbuf[sizeof "-4294967295"];
9
+ char tmpbuf[ sizeof( uid_t ) * 8 / 3 + 2 ];
13
+ tmpbuf[ sizeof(tmpbuf) - 1 ] = '\0';
15
if (_nss_ldap_oc_check (e, "shadowAccount") == NSS_SUCCESS)
21
- tmplen = sizeof (tmpbuf);
22
+ tmplen = sizeof (tmpbuf) - 1;
24
_nss_ldap_assign_attrval (e, AT (uidNumber), &uid, &tmp, &tmplen);
25
if (stat != NSS_SUCCESS)
27
pw->pw_uid = (*uid == '\0') ? UID_NOBODY : (uid_t) atol (uid);
30
- tmplen = sizeof (tmpbuf);
31
+ tmplen = sizeof (tmpbuf) - 1;
33
_nss_ldap_assign_attrval (e, ATM (LM_PASSWD, gidNumber), &gid, &tmp,