Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 Prevent crashing when options are NULL i...
details: https://anonhg.NetBSD.org/src/rev/6c4c5487f852
branches: trunk
changeset: 952858:6c4c5487f852
user: christos <christos%NetBSD.org@localhost>
date: Sat Feb 20 01:18:02 2021 +0000
description:
Prevent crashing when options are NULL in libc while linting
src/lib/libc/posix1e/acl_from_text.c
diffstat:
usr.bin/xlint/lint1/ckgetopt.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (37 lines):
diff -r d076e4aa1002 -r 6c4c5487f852 usr.bin/xlint/lint1/ckgetopt.c
--- a/usr.bin/xlint/lint1/ckgetopt.c Fri Feb 19 23:25:26 2021 +0000
+++ b/usr.bin/xlint/lint1/ckgetopt.c Sat Feb 20 01:18:02 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ckgetopt.c,v 1.2 2021/02/19 14:44:29 rillig Exp $ */
+/* $NetBSD: ckgetopt.c,v 1.3 2021/02/20 01:18:02 christos Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: ckgetopt.c,v 1.2 2021/02/19 14:44:29 rillig Exp $");
+__RCSID("$NetBSD: ckgetopt.c,v 1.3 2021/02/20 01:18:02 christos Exp $");
#endif
#include <stdbool.h>
@@ -100,7 +100,7 @@
static void
check_unlisted_option(char opt)
{
- if (opt == '?')
+ if (opt == '?' || ck.options == NULL)
return;
const char *optptr = strchr(ck.options, opt);
@@ -116,6 +116,9 @@
static void
check_unhandled_option(void)
{
+ if (ck.unhandled_options == NULL)
+ return;
+
for (const char *opt = ck.unhandled_options; *opt != '\0'; opt++) {
if (*opt == ' ' || *opt == ':')
continue;
Home |
Main Index |
Thread Index |
Old Index