Use malloc() instead of static buffer.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22588 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -989,8 +989,10 @@ LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
for (i = 0; i < ent->entry.etypes->len; i++) {
|
for (i = 0; i < ent->entry.etypes->len; i++) {
|
||||||
char buf[100];
|
char *buf;
|
||||||
if (vals[i]->bv_len > sizeof(buf) - 1) {
|
|
||||||
|
buf = malloc(vals[i]->bv_len + 1);
|
||||||
|
if (buf == NULL) {
|
||||||
krb5_set_error_string(context, "malloc: out of memory");
|
krb5_set_error_string(context, "malloc: out of memory");
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -998,6 +1000,7 @@ LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
|
|||||||
memcpy(buf, vals[i]->bv_val, vals[i]->bv_len);
|
memcpy(buf, vals[i]->bv_val, vals[i]->bv_len);
|
||||||
buf[vals[i]->bv_len] = '\0';
|
buf[vals[i]->bv_len] = '\0';
|
||||||
ent->entry.etypes->val[i] = atoi(buf);
|
ent->entry.etypes->val[i] = atoi(buf);
|
||||||
|
free(buf);
|
||||||
}
|
}
|
||||||
ldap_value_free_len(vals);
|
ldap_value_free_len(vals);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user