Mon Jan 31 07:22:16 2011 UTC ()
Protect against de-referencing a pointer which might be NULL.

Fixes PR pkg/44476 from Uwe Klaus


(agc)
diff -r1.31 -r1.32 pkgsrc/pkgtools/pkg_install/files/info/show.c

cvs diff -r1.31 -r1.32 pkgsrc/pkgtools/pkg_install/files/info/show.c (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_install/files/info/show.c 2010/11/22 09:00:12 1.31
+++ pkgsrc/pkgtools/pkg_install/files/info/show.c 2011/01/31 07:22:15 1.32
@@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
1/* $NetBSD: show.c,v 1.31 2010/11/22 09:00:12 joerg Exp $ */ 1/* $NetBSD: show.c,v 1.32 2011/01/31 07:22:15 agc Exp $ */
2 2
3#if HAVE_CONFIG_H 3#if HAVE_CONFIG_H
4#include "config.h" 4#include "config.h"
5#endif 5#endif
6#include <nbcompat.h> 6#include <nbcompat.h>
7#if HAVE_SYS_CDEFS_H 7#if HAVE_SYS_CDEFS_H
8#include <sys/cdefs.h> 8#include <sys/cdefs.h>
9#endif 9#endif
10__RCSID("$NetBSD: show.c,v 1.31 2010/11/22 09:00:12 joerg Exp $"); 10__RCSID("$NetBSD: show.c,v 1.32 2011/01/31 07:22:15 agc Exp $");
11 11
12/* 12/*
13 * FreeBSD install - a package for the installation and maintainance 13 * FreeBSD install - a package for the installation and maintainance
14 * of non-core utilities. 14 * of non-core utilities.
15 * 15 *
16 * Redistribution and use in source and binary forms, with or without 16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions 17 * modification, are permitted provided that the following conditions
18 * are met: 18 * are met:
19 * 1. Redistributions of source code must retain the above copyright 19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer. 20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright 21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the 22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution. 23 * documentation and/or other materials provided with the distribution.
@@ -184,27 +184,28 @@ show_plist(const char *title, package_t  @@ -184,27 +184,28 @@ show_plist(const char *title, package_t
184 case PLIST_CWD: 184 case PLIST_CWD:
185 case PLIST_CMD: 185 case PLIST_CMD:
186 case PLIST_SRC: 186 case PLIST_SRC:
187 case PLIST_UNEXEC: 187 case PLIST_UNEXEC:
188 case PLIST_COMMENT: 188 case PLIST_COMMENT:
189 case PLIST_NAME: 189 case PLIST_NAME:
190 case PLIST_DISPLAY: 190 case PLIST_DISPLAY:
191 case PLIST_PKGDEP: 191 case PLIST_PKGDEP:
192 case PLIST_DIR_RM: 192 case PLIST_DIR_RM:
193 case PLIST_OPTION: 193 case PLIST_OPTION:
194 case PLIST_PKGCFL: 194 case PLIST_PKGCFL:
195 case PLIST_BLDDEP: 195 case PLIST_BLDDEP:
196 case PLIST_PKGDIR: 196 case PLIST_PKGDIR:
197 printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name); 197 printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose,
 198 (p->name) ? p->name : "(null)");
198 break; 199 break;
199 default: 200 default:
200 warnx("unknown command type %d (%s)", p->type, p->name); 201 warnx("unknown command type %d (%s)", p->type, p->name);
201 } 202 }
202 (void) fputc('\n', stdout); 203 (void) fputc('\n', stdout);
203 } 204 }
204 } 205 }
205} 206}
206 207
207/* 208/*
208 * Show all files in the packing list (except ignored ones) 209 * Show all files in the packing list (except ignored ones)
209 */ 210 */
210void 211void