The branch, master has been updated
       via  4298e3f nwrap: Fix strotoul checks for NSS_WRAPPER_MAX_HOSTENTS
      from  7523b05 testsuite: Add compatibility for musl-libc 1.1

https://git.samba.org/?p=nss_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4298e3f08fed7be612155ef7e03998c1aaf9a2ac
Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
Date:   Wed Aug 16 10:35:28 2017 +1200

    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.bagn...@catalyst.net.nz>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/nss_wrapper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 70a5989..835bc87 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -1576,8 +1576,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 "


-- 
NSS Wrapper Repository

Reply via email to