When parsing what should be a UID while resolving a KEYRING ccache
name, don't just depend on strtol() to set errno when the residual
that we pass to it can't be parsed as a number. In addition to
checking errno, pass in and check the value of an "endptr".
[ghudson@mit.edu: simplified slightly]
ticket: 7764 (new)
target_version: 1.12
tags: pullup
{
krb5_error_code ret;
key_serial_t persistent_id, anchor_id, possess_id = 0;
- char *ckname;
+ char *ckname, *cnend;
long uidnum;
*collection_id_out = 0;
*/
if (*collection_name != '\0') {
errno = 0;
- uidnum = strtol(collection_name, NULL, 10);
- if (errno)
+ uidnum = strtol(collection_name, &cnend, 10);
+ if (errno || *cnend != '\0')
return KRB5_KCC_INVALID_UID;
} else {
uidnum = geteuid();