From owner-svn-src-all@freebsd.org Mon Nov 27 09:57:38 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5C81DFD4CC; Mon, 27 Nov 2017 09:57:38 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9355A6AFBE; Mon, 27 Nov 2017 09:57:38 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAR9vbpr063860; Mon, 27 Nov 2017 09:57:37 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAR9vbRh063859; Mon, 27 Nov 2017 09:57:37 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201711270957.vAR9vbRh063859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Mon, 27 Nov 2017 09:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326246 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 326246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 09:57:38 -0000 Author: phk Date: Mon Nov 27 09:57:37 2017 New Revision: 326246 URL: https://svnweb.freebsd.org/changeset/base/326246 Log: Truncate negative lengths to zero Modified: head/lib/libc/stdio/xprintf_hexdump.c Modified: head/lib/libc/stdio/xprintf_hexdump.c ============================================================================== --- head/lib/libc/stdio/xprintf_hexdump.c Mon Nov 27 04:24:48 2017 (r326245) +++ head/lib/libc/stdio/xprintf_hexdump.c Mon Nov 27 09:57:37 2017 (r326246) @@ -50,6 +50,7 @@ int __printf_render_hexdump(struct __printf_io *io, const struct printf_info *pi, const void *const *arg) { unsigned char *p; + int i; unsigned u, l, j, a; char buf[100], *q; int ret; @@ -59,7 +60,10 @@ __printf_render_hexdump(struct __printf_io *io, const else l = 16; p = *((unsigned char **)arg[0]); - u = *((unsigned *)arg[1]); + i = *((int *)arg[1]); + if (i < 0) + i = 0; + u = i; ret = 0; a = 0;