Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Avoid accessing beyond end of empty string.
details: https://anonhg.NetBSD.org/src/rev/a0e11d9d15db
branches: trunk
changeset: 341948:a0e11d9d15db
user: sjg <sjg%NetBSD.org@localhost>
date: Mon Nov 30 23:15:43 2015 +0000
description:
Avoid accessing beyond end of empty string.
Detected by Address Sanitizer - dim at FreeBSD.org
diffstat:
usr.bin/make/cond.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r 90a72c69c8dd -r a0e11d9d15db usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Mon Nov 30 23:00:14 2015 +0000
+++ b/usr.bin/make/cond.c Mon Nov 30 23:15:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $ */
+/* $NetBSD: cond.c,v 1.70 2015/11/30 23:15:43 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.70 2015/11/30 23:15:43 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $");
+__RCSID("$NetBSD: cond.c,v 1.70 2015/11/30 23:15:43 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -489,6 +489,10 @@
unsigned long l_val;
double d_val;
+ if (!*str) {
+ errno = EINVAL;
+ return FALSE;
+ }
errno = 0;
l_val = strtoul(str, &eptr, str[1] == 'x' ? 16 : 10);
ech = *eptr;
Home |
Main Index |
Thread Index |
Old Index