Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netsmb Since "len" has changed to (unsinged) size_t, the...
details: https://anonhg.NetBSD.org/src/rev/9c21a4e67f10
branches: trunk
changeset: 779217:9c21a4e67f10
user: nakayama <nakayama%NetBSD.org@localhost>
date: Fri May 11 14:51:39 2012 +0000
description:
Since "len" has changed to (unsinged) size_t, the while loop
condition (len > 0) became less able to detect its underflow.
So check the subtrahend to avoid the underflow.
Should fix PR kern/44092.
diffstat:
sys/netsmb/subr_mchain.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 1a90146045ac -r 9c21a4e67f10 sys/netsmb/subr_mchain.c
--- a/sys/netsmb/subr_mchain.c Fri May 11 04:05:54 2012 +0000
+++ b/sys/netsmb/subr_mchain.c Fri May 11 14:51:39 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_mchain.c,v 1.20 2010/12/17 13:05:29 pooka Exp $ */
+/* $NetBSD: subr_mchain.c,v 1.21 2012/05/11 14:51:39 nakayama Exp $ */
/*
* Copyright (c) 2000, 2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.20 2010/12/17 13:05:29 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.21 2012/05/11 14:51:39 nakayama Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,7 +66,7 @@
}
}
mp->m_len = 0;
- len -= M_TRAILINGSPACE(mp);
+ len -= min(len, M_TRAILINGSPACE(mp));
if (m != NULL)
for (mtail = m; mtail->m_next != NULL; mtail = mtail->m_next);
@@ -88,7 +88,7 @@
}
mp->m_len = 0;
- len -= M_TRAILINGSPACE(mp);
+ len -= min(len, M_TRAILINGSPACE(mp));
}
if (mtail != NULL)
Home |
Main Index |
Thread Index |
Old Index