Module Name: src Committed By: christos Date: Fri Mar 7 01:04:30 UTC 2014
Modified Files: src/external/bsd/dhcp/dist/common: ns_name.c Log Message: fix incorrect overflow test: https://android-review.googlesource.com/#/c/50570/ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/dhcp/dist/common/ns_name.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/dhcp/dist/common/ns_name.c diff -u src/external/bsd/dhcp/dist/common/ns_name.c:1.4 src/external/bsd/dhcp/dist/common/ns_name.c:1.5 --- src/external/bsd/dhcp/dist/common/ns_name.c:1.4 Tue Mar 26 20:38:08 2013 +++ src/external/bsd/dhcp/dist/common/ns_name.c Thu Mar 6 20:04:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ns_name.c,v 1.4 2013/03/27 00:38:08 christos Exp $ */ +/* $NetBSD: ns_name.c,v 1.5 2014/03/07 01:04:29 christos Exp $ */ /* * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: ns_name.c,v 1.4 2013/03/27 00:38:08 christos Exp $"); +__RCSID("$NetBSD: ns_name.c,v 1.5 2014/03/07 01:04:29 christos Exp $"); #ifndef lint static const char rcsid[] = "Id: ns_name.c,v 1.2 2009/10/28 04:12:29 sar Exp "; @@ -344,11 +344,12 @@ MRns_name_unpack(const u_char *msg, cons } if (len < 0) len = srcp - src + 1; - srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); - if (srcp < msg || srcp >= eom) { /* Out of range. */ + n = ((n & 0x3f) << 8) | (*srcp & 0xff); + if (n >= eom - msg) { / Out of range. */ errno = EMSGSIZE; return (-1); } + srcp = msg + n; checked += 2; /* * Check for loops in the compressed name;