Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2521916yba; Mon, 15 Apr 2019 13:30:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwq6ZNthXgjbBoaGKm4A1QmL8edXs3yvTy19IXAcCtbtymWLXh9g/0r55j4AJLWUDsB02J1 X-Received: by 2002:a62:e412:: with SMTP id r18mr77435097pfh.207.1555360202360; Mon, 15 Apr 2019 13:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360202; cv=none; d=google.com; s=arc-20160816; b=fFZGdVnguhE+Ij/GGAXA6HF82sbxbsjEvl0GB0C3KO7SVVSmn0CTVvsabvTpr72DZs gaYqZNq6Yev8RY7VeKvHsmb8pufJXF1Zgx38EmsYFx30FH/kcr1WSB0RmGxrwSPWNS9S +YNbZr1TfABcL7u34BQU+svYIyazTdlL/c/0eaZTRnzcOLaG7jeZs2M/bVBjjQ660Clx pXvIiDyTPVmCDOeNpgBeJJDTZ/B2AKJ3sHnJG61t0iF+cFcVS1soQasDk2+3dwLfpouO ITUY43Fn7Imj5NMXwVD3OuPpK3U1Fa8QQLX9U9lAehve58t6Uw/fshbT6x1mCtKCD01t PXaw== 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=0RoIpJYExl/qdN4J9pWgHu5J960b/MGXNcMhUT3jGeg=; b=kQyEPPzzOBdrZYOQOB9du4gReTfGvdUtB/ZYn4c8DlJc4jqN3b7ONY39sjj6UfTM8f euWEiB4fjBFv6sS64IjTqULBh3U5YDgVBZOdrIyTNc7IBEMHFw9bRVjwuOOVUr+LZP1Y JTijcGXggXxWwuHx2ylWVurx/VX23ziVlv4WhZ8qMUMsWPtq3AbFM3mQSiKOU9ADE2s7 UFEIwSBP7NhbCr6aPaxXjELbPkCQVNUrZyDiQrfEnleMWHmJgHfq0Vn48QX8dsOYAziD 9pK0z0Bb1UsXULzTfdDso8hcsPaje1Y4Smgw+8Q/8UADL8imixWeMx56GC9WGw+acGIu lf5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XgZc0rhD; 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 r13si20529155pgj.413.2019.04.15.13.29.46; Mon, 15 Apr 2019 13:30:02 -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=XgZc0rhD; 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 S1730020AbfDOTGm (ORCPT + 99 others); Mon, 15 Apr 2019 15:06:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730005AbfDOTGj (ORCPT ); Mon, 15 Apr 2019 15:06:39 -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 E60DD218A1; Mon, 15 Apr 2019 19:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355198; bh=bZSfbFHcG3jH00gD3d3eKSTrGyCjUTsQJvkndIPrh+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgZc0rhDwXnUWyYII/CEeBQFN8rdOLMrvcA8+KE30PWOjWIUSa40vT1SPzvJhgHaZ sBKevqIjAXBIQgRJwWJ0KS/IEnit+tFkmDxytJp+TLY9sxdcA/Sh5K5kO/pTpd2pjQ gSY0FcwsMaggDpcn0OkgXW2MwDtvny+tt5zqS0jg= 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.19 050/101] ALSA: seq: Fix OOB-reads from strlcpy Date: Mon, 15 Apr 2019 20:58:48 +0200 Message-Id: <20190415183743.215721697@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@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 @@ -1252,7 +1252,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; @@ -1530,7 +1530,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; @@ -1592,7 +1592,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;