From owner-svn-src-all@freebsd.org Mon Jul 13 05:59:42 2015 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 A013C99BD9E; Mon, 13 Jul 2015 05:59:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 8870C11F5; Mon, 13 Jul 2015 05:59:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6D5xgNI097351; Mon, 13 Jul 2015 05:59:42 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6D5xg1I097350; Mon, 13 Jul 2015 05:59:42 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507130559.t6D5xg1I097350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 13 Jul 2015 05:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285438 - head/bin/stty X-SVN-Group: head 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.20 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, 13 Jul 2015 05:59:42 -0000 Author: bapt Date: Mon Jul 13 05:59:41 2015 New Revision: 285438 URL: https://svnweb.freebsd.org/changeset/base/285438 Log: Prevent potential integer overflow PR: 192971 Submitted by: David Carlier Modified: head/bin/stty/stty.c Modified: head/bin/stty/stty.c ============================================================================== --- head/bin/stty/stty.c Mon Jul 13 05:56:27 2015 (r285437) +++ head/bin/stty/stty.c Mon Jul 13 05:59:41 2015 (r285438) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ main(int argc, char *argv[]) struct info i; enum FMT fmt; int ch; - const char *file; + const char *file, *errstr = NULL; fmt = NOTSET; i.fd = STDIN_FILENO; @@ -130,7 +131,9 @@ args: argc -= optind; if (isdigit(**argv)) { speed_t speed; - speed = atoi(*argv); + speed = strtonum(*argv, 0, UINT_MAX, &errstr); + if (errstr) + err(1, "speed"); cfsetospeed(&i.t, speed); cfsetispeed(&i.t, speed); i.set = 1;