ipasam: fix a use-after-free issue

Since endptr points to a location inside of dummy, dummy should be freed
only after dereferencing endptr.

Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Sumit Bose 2015-11-18 12:34:49 +01:00 committed by Tomas Babej
parent 99cfc979d5
commit 657cf958c6

View File

@ -2103,11 +2103,12 @@ static bool get_uint32_t_from_ldap_msg(struct ldapsam_privates *ldap_state,
}
l = strtoul(dummy, &endptr, 10);
TALLOC_FREE(dummy);
if (l < 0 || l > UINT32_MAX || *endptr != '\0') {
TALLOC_FREE(dummy);
return false;
}
TALLOC_FREE(dummy);
*val = l;