From 6e6545bfaed3bab9ce836ee82d1abd8f2edba89a Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Tue, 22 Jan 2019 20:01:50 +0200 Subject: 11169 nsswitch: NULL pointer errors Reviewed by: C Fraire Approved by: Richard Lowe --- usr/src/lib/nsswitch/ldap/common/getkeyent.c | 6 ++---- usr/src/lib/nsswitch/ldap/common/getprinter.c | 4 ++-- usr/src/lib/nsswitch/mdns/common/mdns_common.c | 4 +--- usr/src/lib/nsswitch/user/common/getprinter.c | 17 ++++++++--------- 4 files changed, 13 insertions(+), 18 deletions(-) (limited to 'usr/src') diff --git a/usr/src/lib/nsswitch/ldap/common/getkeyent.c b/usr/src/lib/nsswitch/ldap/common/getkeyent.c index 95f27cddb9..6fa6219c6f 100644 --- a/usr/src/lib/nsswitch/ldap/common/getkeyent.c +++ b/usr/src/lib/nsswitch/ldap/common/getkeyent.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include "ldap_common.h" @@ -87,7 +85,7 @@ _nss_ldap_key2str(ldap_backend_ptr be, nss_XbyY_args_t *argp) goto result_key2str; } while (*pkey_array) { - if (strncasecmp(*pkey_array, keytype, keytypelen) == NULL) + if (strncasecmp(*pkey_array, keytype, keytypelen) == 0) break; pkey_array++; } @@ -112,7 +110,7 @@ _nss_ldap_key2str(ldap_backend_ptr be, nss_XbyY_args_t *argp) goto result_key2str; } while (*skey_array) { - if (strncasecmp(*skey_array, keytype, keytypelen) == NULL) + if (strncasecmp(*skey_array, keytype, keytypelen) == 0) break; skey_array++; } diff --git a/usr/src/lib/nsswitch/ldap/common/getprinter.c b/usr/src/lib/nsswitch/ldap/common/getprinter.c index 079741d61e..c24bb67320 100644 --- a/usr/src/lib/nsswitch/ldap/common/getprinter.c +++ b/usr/src/lib/nsswitch/ldap/common/getprinter.c @@ -212,7 +212,7 @@ _nss_ldap_printers2str(ldap_backend_ptr be, nss_XbyY_args_t *argp) * be backslashed plus ending ':' or ','. */ k = 0; - for (kp = attr->attrvalue[j]; *kp != NULL; kp++) + for (kp = attr->attrvalue[j]; *kp != '\0'; kp++) if (*kp == ':') /* count ':' in value */ k++; @@ -259,7 +259,7 @@ append_attr(char *buf, char *attr) } bp = buf; cp = attr; - while (*cp != NULL) { + while (*cp != '\0') { if (*cp == ':') { *bp++ = '\\'; } diff --git a/usr/src/lib/nsswitch/mdns/common/mdns_common.c b/usr/src/lib/nsswitch/mdns/common/mdns_common.c index 3e914e5744..c850d2edac 100644 --- a/usr/src/lib/nsswitch/mdns/common/mdns_common.c +++ b/usr/src/lib/nsswitch/mdns/common/mdns_common.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "mdns_common.h" static int _nss_mdns_queryrecord(const char *rrname, int rrclass, int rrtype, @@ -91,7 +89,7 @@ _nss_mdns_queryrecord(const char *rrname, int rrclass, int rrtype, err = DNSServiceQueryRecord(&ref, flags, opinterface, rrname, rrtype, rrclass, callback, data); if (err != kDNSServiceErr_NoError || ref == NULL || - (sockfd = DNSServiceRefSockFD(ref)) == NULL) { + (sockfd = DNSServiceRefSockFD(ref)) == 0) { DNSServiceRefDeallocate(ref); data->status = NSS_UNAVAIL; return (NSS_UNAVAIL); diff --git a/usr/src/lib/nsswitch/user/common/getprinter.c b/usr/src/lib/nsswitch/user/common/getprinter.c index 7e62b69724..4c64fb79be 100644 --- a/usr/src/lib/nsswitch/user/common/getprinter.c +++ b/usr/src/lib/nsswitch/user/common/getprinter.c @@ -27,8 +27,6 @@ * convenient method of aliasing and specifying an interest list. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #pragma weak _nss_user__printers_constr = _nss_user_printers_constr #include @@ -47,17 +45,18 @@ _nss_user_printers_convert(char *entry, nss_XbyY_args_t *args) int length = 0; if ((value = strpbrk(entry, "\t ")) != NULL) { - *value = NULL; value++; + *value = '\0'; + value++; - while ((*value != NULL) && (isspace(*value) != 0)) + while ((*value != '\0') && (isspace(*value) != 0)) value++; if ((key = strpbrk(value, "\n\t ")) != NULL) - *key = NULL; + *key = '\0'; } - args->buf.buffer[0] = NULL; - if ((value == NULL) || (*value == NULL)) { /* bad value */ + args->buf.buffer[0] = '\0'; + if ((value == NULL) || (*value == '\0')) { /* bad value */ args->erange = 1; return (res); } @@ -71,7 +70,7 @@ _nss_user_printers_convert(char *entry, nss_XbyY_args_t *args) namelist, key); /* append the value ':' must be escaped for posix style names */ - while ((length < args->buf.buflen) && (*value != NULL)) { + while ((length < args->buf.buflen) && (*value != '\0')) { if (*value == ':') args->buf.buffer[length++] = '\\'; args->buf.buffer[length++] = *value++; @@ -82,7 +81,7 @@ _nss_user_printers_convert(char *entry, nss_XbyY_args_t *args) return (res); } - args->buf.buffer[length] = NULL; /* terminate, just in case */ + args->buf.buffer[length] = '\0'; /* terminate, just in case */ args->returnval = args->buf.result; res = NSS_SUCCESS; -- cgit v1.2.3