summaryrefslogtreecommitdiff
path: root/usr/src/cmd/lp
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-23 13:37:06 +0200
committerToomas Soome <tsoome@me.com>2019-07-06 17:24:06 +0300
commite4fb8a5fd5bb5a5d316430c6ac8f6d33704fcf5d (patch)
treee5ecb4c946a63aa42d1f14e2124aa0441847e2ad /usr/src/cmd/lp
parent07c94cbf80ccbba93ea61425c2074f6bfd608a19 (diff)
downloadillumos-gate-e4fb8a5fd5bb5a5d316430c6ac8f6d33704fcf5d.tar.gz
11295 lp: NULL pointer errors
Reviewed by: C Fraire <cfraire@me.com> Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src/cmd/lp')
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/disp1.c2
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/exec.c4
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/files.c4
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/fncs.c2
-rw-r--r--usr/src/cmd/lp/cmd/lpsched/lpfsck.c4
-rw-r--r--usr/src/cmd/lp/filter/postscript/postprint/postprint.c3
-rw-r--r--usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c4
-rw-r--r--usr/src/cmd/lp/lib/lp/files.c3
-rw-r--r--usr/src/cmd/lp/lib/papi/job.c2
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-jobs.c6
-rw-r--r--usr/src/cmd/lp/lib/papi/lpsched-misc.c6
-rw-r--r--usr/src/cmd/lp/lib/papi/ppd.c8
-rw-r--r--usr/src/cmd/lp/model/netpr/netpr.c2
13 files changed, 20 insertions, 30 deletions
diff --git a/usr/src/cmd/lp/cmd/lpsched/disp1.c b/usr/src/cmd/lp/cmd/lpsched/disp1.c
index b3f96ccd21..a1c2dc5ccf 100644
--- a/usr/src/cmd/lp/cmd/lpsched/disp1.c
+++ b/usr/src/cmd/lp/cmd/lpsched/disp1.c
@@ -1161,7 +1161,7 @@ s_pass_peer_connection(char *m, MESG *md)
(void) getmessage(m, S_PASS_PEER_CONNECTION);
syslog(LOG_DEBUG, "s_pass_peer_connection()");
- memset(&recv_fd, NULL, sizeof (recv_fd));
+ memset(&recv_fd, 0, sizeof (recv_fd));
if (ioctl(md->readfd, I_RECVFD, &recv_fd) == 0) {
int fd = recv_fd.fd;
diff --git a/usr/src/cmd/lp/cmd/lpsched/exec.c b/usr/src/cmd/lp/cmd/lpsched/exec.c
index 521a55eaa1..dd9c939d78 100644
--- a/usr/src/cmd/lp/cmd/lpsched/exec.c
+++ b/usr/src/cmd/lp/cmd/lpsched/exec.c
@@ -111,7 +111,7 @@ void clean_string(char *ptr)
wchar_t wc;
size_t len;
- for (cp = ptr; *cp != NULL; ) {
+ for (cp = ptr; *cp != '\0'; ) {
if ((len = mbtowc(&wc, cp, MB_CUR_MAX)) == -1) {
cp++;
continue;
@@ -735,7 +735,7 @@ exec(int type, ...)
} else if (strcmp(clean_title, "") != 0) {
char *ct_p;
- for (ct_p = clean_title; *ct_p != NULL; ct_p++) {
+ for (ct_p = clean_title; *ct_p != '\0'; ct_p++) {
if (*ct_p == '"')
*ct_p = ' ';
}
diff --git a/usr/src/cmd/lp/cmd/lpsched/files.c b/usr/src/cmd/lp/cmd/lpsched/files.c
index 00f2ac85be..a608e2ad82 100644
--- a/usr/src/cmd/lp/cmd/lpsched/files.c
+++ b/usr/src/cmd/lp/cmd/lpsched/files.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lpsched.h"
#include <syslog.h>
#include <strings.h>
@@ -172,7 +170,7 @@ void rmfiles ( RSTATUS * rp, int log_it ) /* funcdef */
p = strdup(rp->req_file); /* remove host/id file */
if (q = strrchr(p, '-')) {
- *q = NULL;
+ *q = '\0';
path = makepath(Lp_Tmp, p, NULL);
(void) Unlink(path);
Free(path);
diff --git a/usr/src/cmd/lp/cmd/lpsched/fncs.c b/usr/src/cmd/lp/cmd/lpsched/fncs.c
index 66f8311fa7..c73b159b96 100644
--- a/usr/src/cmd/lp/cmd/lpsched/fncs.c
+++ b/usr/src/cmd/lp/cmd/lpsched/fncs.c
@@ -898,7 +898,7 @@ void GetRequestFiles(REQUEST *req, char *buffer, int length)
} else if (req->file_list)
strlcpy(buf, *req->file_list, sizeof (buf));
- if (*buf == NULL || !strncmp(buf, SPOOLDIR, sizeof(SPOOLDIR)-1))
+ if (*buf == '\0' || !strncmp(buf, SPOOLDIR, sizeof(SPOOLDIR)-1))
strcpy(buf, "<File name not available>");
if (strlen(buf) > (size_t) 24) {
diff --git a/usr/src/cmd/lp/cmd/lpsched/lpfsck.c b/usr/src/cmd/lp/cmd/lpsched/lpfsck.c
index 3175ae2d17..8b569227d3 100644
--- a/usr/src/cmd/lp/cmd/lpsched/lpfsck.c
+++ b/usr/src/cmd/lp/cmd/lpsched/lpfsck.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "stdarg.h"
#include "stdlib.h"
#include "fcntl.h"
@@ -323,7 +321,7 @@ va_makepath (va_list *pap, char **ret)
char buf[MAXPATHLEN];
int buflen;
- memset(buf, NULL, sizeof (buf));
+ memset(buf, 0, sizeof (buf));
while ((component = va_arg((*pap), char *)) != NULL) {
if (strlcat(buf, component, sizeof (buf)) >= sizeof (buf) ||
strlcat(buf, "/", sizeof (buf)) >= sizeof (buf)) {
diff --git a/usr/src/cmd/lp/filter/postscript/postprint/postprint.c b/usr/src/cmd/lp/filter/postscript/postprint/postprint.c
index 49fe4bb3df..8306342860 100644
--- a/usr/src/cmd/lp/filter/postscript/postprint/postprint.c
+++ b/usr/src/cmd/lp/filter/postscript/postprint/postprint.c
@@ -27,8 +27,6 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
*
* postprint - PostScript translator for ASCII files.
@@ -107,6 +105,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
+#include <string.h>
#include "comments.h" /* PostScript file structuring comments */
#include "gen.h" /* general purpose definitions */
diff --git a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c b/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c
index 72de24d3cd..4b4ab335d8 100644
--- a/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c
+++ b/usr/src/cmd/lp/filter/postscript/postreverse/postreverse.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -254,7 +252,7 @@ ParsePageList(char *list)
char *s1 = page, *s2;
if (s2 = strchr(page, '-')) {
- *s2++ = NULL;
+ *s2++ = '\0';
start = atoi(s1);
end = atoi(s2);
if (end < start) {
diff --git a/usr/src/cmd/lp/lib/lp/files.c b/usr/src/cmd/lp/lib/lp/files.c
index d85484f547..45b9f10869 100644
--- a/usr/src/cmd/lp/lib/lp/files.c
+++ b/usr/src/cmd/lp/lib/lp/files.c
@@ -28,7 +28,6 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
/* EMACS_MODES: !fill, lnumb, !overwrite, !nodelete, !picture */
#include "stdio.h"
@@ -96,7 +95,7 @@ fdgets(char *buf, int len, int fd)
char tmp;
int count = 0;
- memset(buf, NULL, len);
+ memset(buf, 0, len);
while ((count < len) && (Read(fd, &tmp, 1) > 0))
if ((buf[count++] = tmp) == '\n') break;
diff --git a/usr/src/cmd/lp/lib/papi/job.c b/usr/src/cmd/lp/lib/papi/job.c
index aafce80d0c..d4b0bc078f 100644
--- a/usr/src/cmd/lp/lib/papi/job.c
+++ b/usr/src/cmd/lp/lib/papi/job.c
@@ -971,7 +971,7 @@ papiJobQuery(papi_service_t handle, char *printer, int32_t job_id,
return (PAPI_DEVICE_ERROR);
}
- if ((request_id == NULL) || (request_id[0] == NULL))
+ if ((request_id == NULL) || (request_id[0] == '\0'))
return (PAPI_NOT_FOUND);
if ((*job = j = calloc(1, sizeof (*j))) == NULL)
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c b/usr/src/cmd/lp/lib/papi/lpsched-jobs.c
index 0713de64c2..3232b89667 100644
--- a/usr/src/cmd/lp/lib/papi/lpsched-jobs.c
+++ b/usr/src/cmd/lp/lib/papi/lpsched-jobs.c
@@ -103,7 +103,7 @@ job_attributes_to_lpsched_request(papi_service_t svc, REQUEST *r,
papiAttributeListGetLPString(attributes, "form", &r->form);
/* set the page range */
- memset(tmp, NULL, sizeof (tmp));
+ memset(tmp, 0, sizeof (tmp));
tmp[0] = papiAttributeListFind(attributes, "page-ranges");
if (tmp[0] != NULL) {
char buf[BUFSIZ];
@@ -369,11 +369,11 @@ lpsched_request_outcome_to_attributes(papi_attribute_t ***attributes,
static void
lpsched_user_to_job_attributes(papi_attribute_t ***list, char *user)
{
- if ((list != NULL) && (user != NULL) && (user[0] != NULL)) {
+ if ((list != NULL) && (user != NULL) && (user[0] != '\0')) {
char *host = strrchr(user, '@');
if (host != NULL) {
- *host = NULL;
+ *host = '\0';
papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
"job-originating-user-name", user);
papiAttributeListAddString(list, PAPI_ATTR_REPLACE,
diff --git a/usr/src/cmd/lp/lib/papi/lpsched-misc.c b/usr/src/cmd/lp/lib/papi/lpsched-misc.c
index ce45d1aa5c..6675bdd213 100644
--- a/usr/src/cmd/lp/lib/papi/lpsched-misc.c
+++ b/usr/src/cmd/lp/lib/papi/lpsched-misc.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*LINTLIBRARY*/
#include <stdio.h>
@@ -41,7 +39,7 @@ papiAttributeListAddLPString(papi_attribute_t ***list, int flags, char *name,
papi_status_t result = PAPI_BAD_ARGUMENT;
if ((list != NULL) && (name != NULL) && (value != NULL) &&
- (value[0] != NULL))
+ (value[0] != '\0'))
result = papiAttributeListAddString(list, flags, name, value);
return (result);
}
@@ -119,7 +117,7 @@ printer_name_from_uri_id(char *uri, int32_t id)
result = "";
}
- if ((result[0] == NULL) && (id != -1)) {
+ if ((result[0] == '\0') && (id != -1)) {
char path[32];
snprintf(path, sizeof (path), "%d-0", id);
diff --git a/usr/src/cmd/lp/lib/papi/ppd.c b/usr/src/cmd/lp/lib/papi/ppd.c
index 57d42c8841..26fcced189 100644
--- a/usr/src/cmd/lp/lib/papi/ppd.c
+++ b/usr/src/cmd/lp/lib/papi/ppd.c
@@ -54,7 +54,7 @@ process_line(char *line, char **key, char **value, char **comment)
* or
* *key value/comment: data
*/
- *ptr++ = NULL;
+ *ptr++ = '\0';
while (isspace(*ptr) != 0)
ptr++;
@@ -64,7 +64,7 @@ process_line(char *line, char **key, char **value, char **comment)
* line is in the form:
* *key value/comment: data
*/
- *ptr++ = NULL;
+ *ptr++ = '\0';
while (*ptr == ' ')
ptr++;
}
@@ -75,7 +75,7 @@ process_line(char *line, char **key, char **value, char **comment)
*value = ptr;
if ((ptr = strchr(ptr, '/')) != NULL) {
- *ptr++ = NULL;
+ *ptr++ = '\0';
*comment = ptr;
}
}
@@ -107,7 +107,7 @@ PPDFileToAttributesList(papi_attribute_t ***attributes, char *filename)
continue;
if ((text = strrchr(line, '\n')) != NULL)
- *text = NULL;
+ *text = '\0';
process_line(line, &key, &value, &text);
diff --git a/usr/src/cmd/lp/model/netpr/netpr.c b/usr/src/cmd/lp/model/netpr/netpr.c
index 9516781fad..243200a4cf 100644
--- a/usr/src/cmd/lp/model/netpr/netpr.c
+++ b/usr/src/cmd/lp/model/netpr/netpr.c
@@ -89,7 +89,7 @@ net_open(char *host, int timeout)
return (-1);
}
- (void) memset((char *)&sin, NULL, sizeof (sin));
+ (void) memset((char *)&sin, 0, sizeof (sin));
if ((hp = getipnodebyname(host, AF_INET6, AI_DEFAULT,
&error_num)) == NULL) {
syslog(LOG_DEBUG|LOG_ERR, "unknown host %s "