From: Ian Darwin Date: Mon, 14 Sep 1992 14:17:02 +0000 (+0000) Subject: Fix a null-pointer bug in Zoulas' previous bug fix. X-Git-Tag: FILE3_27~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6cc3062284081525ea28df025c4bd5822934023;p=file Fix a null-pointer bug in Zoulas' previous bug fix. --- diff --git a/src/softmagic.c b/src/softmagic.c index 6ded6d0d..df0efb3e 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -34,7 +34,7 @@ #ifndef lint static char *moduleid = - "@(#)$Id: softmagic.c,v 1.15 1992/09/11 10:09:26 ian Exp $"; + "@(#)$Id: softmagic.c,v 1.16 1992/09/14 14:17:02 ian Exp $"; #endif /* lint */ static int match __P((unsigned char *)); @@ -122,14 +122,16 @@ unsigned char *s; if ((rt=strchr(p->s, '\n')) != NULL) *rt = '\0'; (void) printf(m->desc, p->s); - *rt = '\n'; + if (rt) + *rt = '\n'; break; case DATE: pp = ctime((time_t*) &p->l); if ((rt = strchr(pp, '\n')) != NULL) *rt = '\0'; (void) printf(m->desc, pp); - *rt = '\n'; + if (rt) + *rt = '\n'; break; default: error("invalid m->type (%d) in mprint().\n", m->type);