these functions return an error code, and are not explicitly
documented to set errno, but they are nonstandard and the historical
implementations do set errno as well, and some applications expect
this behavior. do likewise for compatibility.
patch by Rudolph Pereira.
free(mem);
free(line);
pthread_setcancelstate(cs, 0);
free(mem);
free(line);
pthread_setcancelstate(cs, 0);
}
free(line);
pthread_setcancelstate(cs, 0);
}
free(line);
pthread_setcancelstate(cs, 0);
/* Disallow potentially-malicious user names */
if (*name=='.' || strchr(name, '/') || !l)
/* Disallow potentially-malicious user names */
if (*name=='.' || strchr(name, '/') || !l)
/* Buffer size must at least be able to hold name, plus some.. */
/* Buffer size must at least be able to hold name, plus some.. */
- if (size < l+100) return ERANGE;
+ if (size < l+100)
+ return errno = EINVAL;
/* Protect against truncation */
if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
/* Protect against truncation */
if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC);
if (fd >= 0) {
fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC);
if (fd >= 0) {
break;
}
pthread_cleanup_pop(1);
break;
}
pthread_cleanup_pop(1);