summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-22 13:03:34 +0200
committerToomas Soome <tsoome@me.com>2019-07-03 10:36:13 +0300
commitbaf3abb99faf2cc8376a1f8ab38dfa1730c2ca13 (patch)
tree22c6a14a3b0e628e1b6afabbddc75cdb895eea0f
parent21f023df5de311466c7fef39e70e23b3551a16d5 (diff)
downloadillumos-joyent-baf3abb99faf2cc8376a1f8ab38dfa1730c2ca13.tar.gz
11148 libbsm: NULL pointer errors
Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net> Approved by: Richard Lowe <richlowe@richlowe.net>
-rw-r--r--usr/src/lib/libbsm/common/audit_allocate.c3
-rw-r--r--usr/src/lib/libbsm/common/devalloc.c4
-rw-r--r--usr/src/lib/libbsm/common/getdaent.c8
-rw-r--r--usr/src/lib/libbsm/common/getdment.c4
4 files changed, 8 insertions, 11 deletions
diff --git a/usr/src/lib/libbsm/common/audit_allocate.c b/usr/src/lib/libbsm/common/audit_allocate.c
index 745c40f82e..893abacbff 100644
--- a/usr/src/lib/libbsm/common/audit_allocate.c
+++ b/usr/src/lib/libbsm/common/audit_allocate.c
@@ -119,8 +119,7 @@ audit_allocate_record(status)
else
event = s_audit;
- if (au_preselect(event, &mask.ai_mask, AU_PRS_BOTH, AU_PRS_REREAD)
- == NULL)
+ if (au_preselect(event, &mask.ai_mask, AU_PRS_BOTH, AU_PRS_REREAD) == 0)
return (0);
(void) au_write(ad, au_to_me()); /* add subject token */
diff --git a/usr/src/lib/libbsm/common/devalloc.c b/usr/src/lib/libbsm/common/devalloc.c
index f28f91766a..aca1fabe65 100644
--- a/usr/src/lib/libbsm/common/devalloc.c
+++ b/usr/src/lib/libbsm/common/devalloc.c
@@ -1912,7 +1912,7 @@ da_remove_list(devlist_t *dlist, char *link, int type, char *devname, int size)
struct stat rmstat;
deventry_t *dentry, *current, *prev;
- if (type != NULL)
+ if (type != 0)
flag = type;
else if (link == NULL)
return (-1);
@@ -1949,7 +1949,7 @@ da_remove_list(devlist_t *dlist, char *link, int type, char *devname, int size)
return (-1);
}
- if ((type != NULL) && (link == NULL)) {
+ if ((type != 0) && (link == NULL)) {
for (current = dentry, prev = dentry; current != NULL;
current = current->next) {
oldlist = strdup(current->devinfo.devlist);
diff --git a/usr/src/lib/libbsm/common/getdaent.c b/usr/src/lib/libbsm/common/getdaent.c
index 836640f714..e7f6b83a7c 100644
--- a/usr/src/lib/libbsm/common/getdaent.c
+++ b/usr/src/lib/libbsm/common/getdaent.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
@@ -133,7 +131,7 @@ getdadmline(char *buff, int len, FILE *stream)
do {
cp = buff;
- *cp = NULL;
+ *cp = '\0';
do {
contline = 0;
if (fgets(cp, len - charcnt, stream) == NULL) {
@@ -148,7 +146,7 @@ getdadmline(char *buff, int len, FILE *stream)
}
else
contline = 0;
- *ccp = NULL;
+ *ccp = '\0';
}
tmpcnt = strlen(cp);
cp += tmpcnt;
@@ -156,7 +154,7 @@ getdadmline(char *buff, int len, FILE *stream)
} while ((contline) || (charcnt == 0));
ccp = strpbrk(buff, "#");
if (ccp != NULL)
- *ccp = NULL;
+ *ccp = '\0';
charcnt = strlen(buff);
} while ((fileerr == 0) && (charcnt == 0));
diff --git a/usr/src/lib/libbsm/common/getdment.c b/usr/src/lib/libbsm/common/getdment.c
index 3f1953d956..9031250e79 100644
--- a/usr/src/lib/libbsm/common/getdment.c
+++ b/usr/src/lib/libbsm/common/getdment.c
@@ -680,7 +680,7 @@ getdmapfield(char *ptr)
ptr = trim_white(ptr);
if (ptr == NULL)
return (NULL);
- if (*ptr == NULL)
+ if (*ptr == '\0')
return (NULL);
return (ptr);
@@ -700,7 +700,7 @@ getdmapdfield(char *ptr)
tptr = dmapdskip(ptr);
if (ptr == NULL)
return (NULL);
- if (*ptr == NULL)
+ if (*ptr == '\0')
return (NULL);
return (ptr);