mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
nwrap: Fix strotoul checks for NSS_WRAPPER_MAX_HOSTENTS
The env and endptr pointers need to be dereferenced, but that is not enough: we don't really want to regard an empty string (*env == '\0') as a valid number. Found by GCC 8.0.0 20170705 (experimental). [2095/4103] Compiling lib/nss_wrapper/nss_wrapper.c ../lib/nss_wrapper/nss_wrapper.c: In function "nwrap_init": ../lib/nss_wrapper/nss_wrapper.c:1571:13: warning: comparison between pointer and zero character constant [-Wpointer-compare] if (((env != '\0') && (endptr == '\0')) || ^~ ../lib/nss_wrapper/nss_wrapper.c:1571:9: note: did you mean to dereference the pointer? if (((env != '\0') && (endptr == '\0')) || ^ ../lib/nss_wrapper/nss_wrapper.c:1571:33: warning: comparison between pointer and zero character constant [-Wpointer-compare] if (((env != '\0') && (endptr == '\0')) || ^~ ../lib/nss_wrapper/nss_wrapper.c:1571:26: note: did you mean to dereference the pointer? if (((env != '\0') && (endptr == '\0')) || Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Oct 19 16:42:17 CEST 2017 on sn-devel-144
This commit is contained in:
parent
5dc773a5b0
commit
42e7671226
@ -1567,8 +1567,9 @@ static void nwrap_init(void)
|
||||
|
||||
env = getenv("NSS_WRAPPER_MAX_HOSTENTS");
|
||||
if (env != NULL) {
|
||||
max_hostents_tmp = (size_t)strtol(env, &endptr, 10);
|
||||
if (((env != '\0') && (endptr == '\0')) ||
|
||||
max_hostents_tmp = (size_t)strtoul(env, &endptr, 10);
|
||||
if ((*env == '\0') ||
|
||||
(*endptr != '\0') ||
|
||||
(max_hostents_tmp == 0)) {
|
||||
NWRAP_LOG(NWRAP_LOG_DEBUG,
|
||||
"Error parsing NSS_WRAPPER_MAX_HOSTENTS "
|
||||
|
Loading…
Reference in New Issue
Block a user