pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib Pull over v1.36 from sr...
details: https://anonhg.NetBSD.org/pkgsrc/rev/af75471137a0
branches: trunk
changeset: 510784:af75471137a0
user: wiz <wiz%pkgsrc.org@localhost>
date: Tue Apr 04 06:34:25 2006 +0000
description:
Pull over v1.36 from src/usr.sbin:
revision 1.36
date: 2006/03/17 01:58:25; author: hubertf; state: Exp; lines: +11 -3
We can't sprintf() into a NULL pointer - catch that properly
for ALL cases.
Coverity CID 861
diffstat:
pkgtools/pkg_install/files/lib/pen.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 769cc2675aa4 -r af75471137a0 pkgtools/pkg_install/files/lib/pen.c
--- a/pkgtools/pkg_install/files/lib/pen.c Tue Apr 04 06:32:59 2006 +0000
+++ b/pkgtools/pkg_install/files/lib/pen.c Tue Apr 04 06:34:25 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.18 2005/05/30 13:23:32 wiz Exp $ */
+/* $NetBSD: pen.c,v 1.19 2006/04/04 06:34:25 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.18 2005/05/30 13:23:32 wiz Exp $");
+__RCSID("$NetBSD: pen.c,v 1.19 2006/04/04 06:34:25 wiz Exp $");
#endif
#endif
@@ -103,7 +103,15 @@
char *cp;
struct stat sb;
- if (pen && pen[0] && stat(pen, &sb) != FAIL && (min_free(pen) >= sz))
+ if (pen == NULL) {
+ cleanup(0);
+ errx(2,
+ "find_play_pen(): 'pen' variable is NULL\n"
+ "(this should not happen, please report!");
+ return NULL;
+ }
+
+ if (pen[0] && stat(pen, &sb) != FAIL && (min_free(pen) >= sz))
return pen;
else if ((cp = getenv("PKG_TMPDIR")) != NULL && stat(cp, &sb) != FAIL && (min_free(cp) >= sz))
(void) snprintf(pen, pensize, "%s/instmp.XXXXXX", cp);
Home |
Main Index |
Thread Index |
Old Index