Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2521485yba; Mon, 15 Apr 2019 13:29:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxffgF79AnFy9Lyr9m2AwuHYqLHcFinqdgMU/Rf2TlWrKJOnu4hPCpw0XTvjbXTHK5MU3Mj X-Received: by 2002:a62:cfc4:: with SMTP id b187mr76890459pfg.130.1555360164719; Mon, 15 Apr 2019 13:29:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360164; cv=none; d=google.com; s=arc-20160816; b=Pq20srdp41/qZhyPi2YNcRT4APHGoAxKNzuWEUrSgLOauPALauQRubWbRu7vMLFuOe MPVqJTWtXvhoylxeGjy12a/J7dfR17m9utXnQeaDZEeiuGyJegK0j78t4Ve+edUU3w9d 45tpPPv9mvfTp73zSGxDKiImoNXfNNUqiO8sUUsHjwJApjAAZJ9SLxMSxd83JvgRSDcf TrMO5JRD5DYpV+q2Rqso/KmhGVfbCxg9UwOTUzsVweY/Yg4B1BHIkgDmdenX4S1BQ4dh Qm4Cv3IAqLilloELOQ2MRHS9jnrkTwhLGcmdggP72GCk6mnb3MqkSIkpOp7yYLq1jOMf TV9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+QSANSQntftKieNruOcZWj3hzvm4R5vprYybqkbaSgs=; b=Oj4OUMBnCXCA7DkEuuPmMe8GmhZHc27lz3gD98Egr3z3ueq364l2YqwcKYl73HomF4 jv30UlPzTKledB39gGT+TfQ5xsGl1O1Rc1X4r76/Y0dprfzsezvtiwuDTgZCdbqI2pUg doRS0vxIGly+r7DxQdB89DTP/GzQwETcWu6mKJ6THQabz0uhrXEzJXlK+U5JqTO/qHEk BrWW0/HyYrkixwu18wHblUOc0CnitYRSQDUpYHMjSsa7TipDENjQ7B2bYX/Xj1H3ZQn0 p/4yspaOXgEu+nJ6yHYobElBQAeu5W5CHNemvdhN9tRZ762zWG3rxtxw56NeIDvepO8i R5gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lfPL0eyL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u20si45811392pgh.204.2019.04.15.13.29.08; Mon, 15 Apr 2019 13:29:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lfPL0eyL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729020AbfDOSr5 (ORCPT + 99 others); Mon, 15 Apr 2019 14:47:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:51600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728992AbfDOSrz (ORCPT ); Mon, 15 Apr 2019 14:47:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14996218EA; Mon, 15 Apr 2019 18:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354074; bh=Z+0BH9rrIJ2/xEPwPe5vRIkDigzEUH1mKpbqEuDS2NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfPL0eyLnhwm5KAvIcoDJ1RjDs7rsZgAZqf97+hU/CWSlxryZwwfUsXTFsMSXmVrs 1kZqx/7SjqfM93QtB38H1eaAES5idxmdx4AxXfnP89SN12FTj/0bLQw72HiFePmpJG x0WwPm9iidWt2jnaBI3Y27v+P6xQApz33AFHAVzs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zubin Mithra , Guenter Roeck , Takashi Iwai Subject: [PATCH 4.9 63/76] ALSA: seq: Fix OOB-reads from strlcpy Date: Mon, 15 Apr 2019 20:44:27 +0200 Message-Id: <20190415183725.660783720@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183707.712011689@linuxfoundation.org> References: <20190415183707.712011689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zubin Mithra commit 212ac181c158c09038c474ba68068be49caecebb upstream. When ioctl calls are made with non-null-terminated userspace strings, strlcpy causes an OOB-read from within strlen. Fix by changing to use strscpy instead. Signed-off-by: Zubin Mithra Reviewed-by: Guenter Roeck Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/seq/seq_clientmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1249,7 +1249,7 @@ static int snd_seq_ioctl_set_client_info /* fill the info fields */ if (client_info->name[0]) - strlcpy(client->name, client_info->name, sizeof(client->name)); + strscpy(client->name, client_info->name, sizeof(client->name)); client->filter = client_info->filter; client->event_lost = client_info->event_lost; @@ -1527,7 +1527,7 @@ static int snd_seq_ioctl_create_queue(st /* set queue name */ if (!info->name[0]) snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue); - strlcpy(q->name, info->name, sizeof(q->name)); + strscpy(q->name, info->name, sizeof(q->name)); snd_use_lock_free(&q->use_lock); return 0; @@ -1589,7 +1589,7 @@ static int snd_seq_ioctl_set_queue_info( queuefree(q); return -EPERM; } - strlcpy(q->name, info->name, sizeof(q->name)); + strscpy(q->name, info->name, sizeof(q->name)); queuefree(q); return 0;