diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-21 11:21:40 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-06-18 21:24:17 +0300 |
commit | 344db6f401efe76f7e1d4f4c1a644ae593910219 (patch) | |
tree | 5335c1697bc1d14a219e66501d6e0ed73b0c0b59 | |
parent | e86c3f00315e5838c0ec0b14f34b94c292085956 (diff) | |
download | illumos-joyent-344db6f401efe76f7e1d4f4c1a644ae593910219.tar.gz |
11092 libnsl: NULL pointer errors
Reviewed by: Norm Jacobs <naj@snapcon.com>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/lib/libnsl/dial/interface.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libnsl/netselect/netselect.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libnsl/nss/getexecattr.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libnsl/nss/parse.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/clnt_generic.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/clnt_simple.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/netname.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/rpc_generic.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/rpcb_clnt.c | 4 |
9 files changed, 14 insertions, 22 deletions
diff --git a/usr/src/lib/libnsl/dial/interface.c b/usr/src/lib/libnsl/dial/interface.c index 09f0a8d55a..2dbd10375e 100644 --- a/usr/src/lib/libnsl/dial/interface.c +++ b/usr/src/lib/libnsl/dial/interface.c @@ -186,18 +186,18 @@ twrite(int fd, char *buf, unsigned nbytes) } if (info.tsdu <= 0 || nbytes <= info.tsdu) - return ((ssize_t)t_snd(fd, buf, nbytes, NULL)); + return ((ssize_t)t_snd(fd, buf, nbytes, 0)); /* if get here, then there is a limit on transmit size */ /* (info.tsdu > 0) and buf exceeds it */ i = ret = 0; while (nbytes >= info.tsdu) { - if ((ret = t_snd(fd, &buf[i], info.tsdu, NULL)) != info.tsdu) + if ((ret = t_snd(fd, &buf[i], info.tsdu, 0)) != info.tsdu) return ((ssize_t)(ret >= 0 ? (i + ret) : ret)); i += info.tsdu; nbytes -= info.tsdu; } if (nbytes != 0) { - if ((ret = t_snd(fd, &buf[i], nbytes, NULL)) != nbytes) + if ((ret = t_snd(fd, &buf[i], nbytes, 0)) != nbytes) return ((ssize_t)(ret >= 0 ? (i + ret) : ret)); i += nbytes; } diff --git a/usr/src/lib/libnsl/netselect/netselect.c b/usr/src/lib/libnsl/netselect/netselect.c index 41dfa4909a..7225fa86a6 100644 --- a/usr/src/lib/libnsl/netselect/netselect.c +++ b/usr/src/lib/libnsl/netselect/netselect.c @@ -463,7 +463,7 @@ setnetpath(void) /* Skip all leading ':'s */ while (*tp && *tp == ':') tp++; - if (*tp == NULL) + if (*tp == '\0') break; /* last one */ netid = tp; while (*tp && *tp != ':') diff --git a/usr/src/lib/libnsl/nss/getexecattr.c b/usr/src/lib/libnsl/nss/getexecattr.c index 8df3b6a076..7c04fe2ec1 100644 --- a/usr/src/lib/libnsl/nss/getexecattr.c +++ b/usr/src/lib/libnsl/nss/getexecattr.c @@ -298,7 +298,7 @@ _doexeclist(nss_XbyY_args_t *argp) else status = 0; } - (void) memset(argp->buf.buffer, NULL, argp->buf.buflen); + (void) memset(argp->buf.buffer, 0, argp->buf.buflen); return (status); diff --git a/usr/src/lib/libnsl/nss/parse.c b/usr/src/lib/libnsl/nss/parse.c index 80c22a3e40..56d382daaa 100644 --- a/usr/src/lib/libnsl/nss/parse.c +++ b/usr/src/lib/libnsl/nss/parse.c @@ -25,8 +25,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "mt.h" #include <stdio.h> #include <stdlib.h> @@ -135,7 +133,7 @@ _unescape(char *s, char *esc) else tmp[j++] = s[i]; } - tmp[j] = NULL; + tmp[j] = '\0'; return (tmp); } diff --git a/usr/src/lib/libnsl/rpc/clnt_generic.c b/usr/src/lib/libnsl/rpc/clnt_generic.c index f89c1d5f75..34deeb1f2c 100644 --- a/usr/src/lib/libnsl/rpc/clnt_generic.c +++ b/usr/src/lib/libnsl/rpc/clnt_generic.c @@ -32,8 +32,6 @@ * California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "mt.h" #include "rpc_mt.h" #include <stdio.h> @@ -425,11 +423,11 @@ clnt_create_service_timed(const char *host, const char *service, netdir_free((void *)raddrs, ND_ADDRLIST); if (port) { - if (strcmp(nconf->nc_protofmly, NC_INET) == NULL) + if (strcmp(nconf->nc_protofmly, NC_INET) == 0) /* LINTED pointer alignment */ ((struct sockaddr_in *) tbind->addr.buf)->sin_port = htons(port); - else if (strcmp(nconf->nc_protofmly, NC_INET6) == NULL) + else if (strcmp(nconf->nc_protofmly, NC_INET6) == 0) /* LINTED pointer alignment */ ((struct sockaddr_in6 *) tbind->addr.buf)->sin6_port = htons(port); diff --git a/usr/src/lib/libnsl/rpc/clnt_simple.c b/usr/src/lib/libnsl/rpc/clnt_simple.c index b33e1bb85b..78e88fce29 100644 --- a/usr/src/lib/libnsl/rpc/clnt_simple.c +++ b/usr/src/lib/libnsl/rpc/clnt_simple.c @@ -32,8 +32,6 @@ * California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Simplified front end to client rpc. */ @@ -115,7 +113,7 @@ rpc_call(const char *host, const rpcprog_t prognum, const rpcvers_t versnum, return (rpc_createerr.cf_stat); } - if ((nettype == NULL) || (nettype[0] == NULL)) + if ((nettype == NULL) || (nettype[0] == '\0')) nettype = "netpath"; if (!(rcp->valid && rcp->pid == getpid() && diff --git a/usr/src/lib/libnsl/rpc/netname.c b/usr/src/lib/libnsl/rpc/netname.c index 1ac9a58e3d..0e5b19d2a0 100644 --- a/usr/src/lib/libnsl/rpc/netname.c +++ b/usr/src/lib/libnsl/rpc/netname.c @@ -306,7 +306,7 @@ host2netname(char netname[MAXNETNAMELEN + 1], const char *host, } (void) strcpy(domainname, p); } else { - domainname[0] = NULL; + domainname[0] = '\0'; if (getdomainname(domainname, MAXHOSTNAMELEN) < 0) return (0); } diff --git a/usr/src/lib/libnsl/rpc/rpc_generic.c b/usr/src/lib/libnsl/rpc/rpc_generic.c index 65fb2d08a9..34bb85c97c 100644 --- a/usr/src/lib/libnsl/rpc/rpc_generic.c +++ b/usr/src/lib/libnsl/rpc/rpc_generic.c @@ -32,8 +32,6 @@ * California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Miscl routines for RPC. */ @@ -168,7 +166,7 @@ getnettype(const char *nettype) { int i; - if ((nettype == NULL) || (nettype[0] == NULL)) + if ((nettype == NULL) || (nettype[0] == '\0')) return (_RPC_NETPATH); /* Default */ for (i = 0; _rpctypelist[i].name; i++) @@ -250,7 +248,7 @@ __rpc_getconfip(char *nettype) netid = netid_tcp; else return (NULL); - if ((netid == NULL) || (netid[0] == NULL)) + if ((netid == NULL) || (netid[0] == '\0')) return (NULL); return (getnetconfigent(netid)); } diff --git a/usr/src/lib/libnsl/rpc/rpcb_clnt.c b/usr/src/lib/libnsl/rpc/rpcb_clnt.c index 0fb7a8f32e..1b5a56910d 100644 --- a/usr/src/lib/libnsl/rpc/rpcb_clnt.c +++ b/usr/src/lib/libnsl/rpc/rpcb_clnt.c @@ -544,7 +544,7 @@ got_entry(rpcb_entry_list_ptr relp, struct netconfig *nconf) if ((strcmp(nconf->nc_proto, rmap->r_nc_proto) == 0) && (strcmp(nconf->nc_protofmly, rmap->r_nc_protofmly) == 0) && (nconf->nc_semantics == rmap->r_nc_semantics) && - (rmap->r_maddr != NULL) && (rmap->r_maddr[0] != NULL)) { + (rmap->r_maddr != NULL) && (rmap->r_maddr[0] != 0)) { na = uaddr2taddr(nconf, rmap->r_maddr); break; } @@ -1226,7 +1226,7 @@ rpcb_gettime(const char *host, time_t *timep) int vers; enum clnt_stat st; - if ((host == NULL) || (host[0] == NULL)) { + if ((host == NULL) || (host[0] == '\0')) { (void) time(timep); return (TRUE); } |