Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/intrctl fix intrctl_io_firstline() to properly retu...
details: https://anonhg.NetBSD.org/src/rev/65b3a5ecb669
branches: trunk
changeset: 320110:65b3a5ecb669
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Jun 23 11:11:00 2018 +0000
description:
fix intrctl_io_firstline() to properly return NULL if there are no records
to show
diffstat:
usr.sbin/intrctl/intrctl_io.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r 6d0993f7662a -r 65b3a5ecb669 usr.sbin/intrctl/intrctl_io.c
--- a/usr.sbin/intrctl/intrctl_io.c Sat Jun 23 10:30:22 2018 +0000
+++ b/usr.sbin/intrctl/intrctl_io.c Sat Jun 23 11:11:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intrctl_io.c,v 1.3 2016/08/05 06:58:55 knakahara Exp $ */
+/* $NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: intrctl_io.c,v 1.3 2016/08/05 06:58:55 knakahara Exp $");
+__RCSID("$NetBSD: intrctl_io.c,v 1.4 2018/06/23 11:11:00 jdolecek Exp $");
#include <sys/sysctl.h>
#include <sys/intrio.h>
@@ -108,8 +108,15 @@
intrctl_io_firstline(void *handle)
{
struct intrio_list *list = handle;
+ struct intrio_list_line *next;
+ char *buf_end;
- return (struct intrio_list_line *)((char *)list + list->il_lineoffset);
+ buf_end = (char *)list + list->il_bufsize;
+ next = (struct intrio_list_line *)((char *)list + list->il_lineoffset);
+ if ((char *)next >= buf_end)
+ return NULL;
+
+ return next;
}
struct intrio_list_line *
Home |
Main Index |
Thread Index |
Old Index