Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2458058yba; Mon, 15 Apr 2019 12:04:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUZqRkQAbYW2r0eT0pD+NSsd3bAVa5fX/7TgOs6aOWDDGnAgSx3ZhxcYOABgYkD2rGYExE X-Received: by 2002:a63:5a47:: with SMTP id k7mr71832233pgm.174.1555355065443; Mon, 15 Apr 2019 12:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555355065; cv=none; d=google.com; s=arc-20160816; b=dYZ8Ems4ehz5Y+vn3uOhpnzeaE2xIpD9DVuKbgpye8hZ3nkk1sNeKiMXuSyLbSq6Gx 0q+b6wgHouYUTe/BhAVKMtE+8RQwA1koiaOCs8YGX/hPK5Hb7owHSJq0MS5MyxCu+2zW /+5wgz6L3EHQ2MTiyGcPz1Rfz+6co53QqzxrrBwYYWxh6RHt7q+tX0/d9TmiPWdyCFeI mcAeTIFCdXM9a3t1sd2o0ZGuF1JPsqfPqJLF0i7ga3ekqUWQw6LqYu7n/UomivmKmpNw vmwXAHqSwtL9UawDy1iVc6YuemqXzi0t6ZkDoI95yM+WtU52X1CBDGBCW7MYv80BzIem lh8A== 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=x/uubLyw4tb0UHpGFaD31E5R+4bySIHWRHh7CRNZNEFj3enQKmOrX74RPNVzM1yYwh QLjmhOres529qMRwwzkIhHMFLTQe0W/e3pp1MaTRRGeYkbJxM8vPJvYaHo5nQs5FVFux jl3XMr6TYLDq8S0Ju2c6XiyWmmps6gfSf+t1bPJ/la6l58A5vLw3md/9kGxdHH5tg2Zd 5uskjrK3V4hU9xXGN2iIbDKQRhs9aA1+MMvwoWEk1aiWVmIXh9eEfXGvNcfod8ce/Mrb NjEY43IKUsxw7LZWkEe7lEQwSjpvk/0M1oIC6nET6ehH999RxXk5WRdjOHW/zDqi3VrF 0c9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bTV4zlKt; 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 z12si42388325pln.248.2019.04.15.12.04.08; Mon, 15 Apr 2019 12:04:25 -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=bTV4zlKt; 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 S1729101AbfDOTDD (ORCPT + 99 others); Mon, 15 Apr 2019 15:03:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729063AbfDOTC6 (ORCPT ); Mon, 15 Apr 2019 15:02:58 -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 ABFA921904; Mon, 15 Apr 2019 19:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354977; bh=Z+0BH9rrIJ2/xEPwPe5vRIkDigzEUH1mKpbqEuDS2NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bTV4zlKtQlv38/sRb9dh7+H9FBCeNvFfXrloqyK69/HkU4RJT3K4mzC1JwNfI26g2 c4eQqsmkBwOIIzbx9I3mUltsIM09OQjTWdR/gdhcmKO4VKnngXZ8W2s0dhLqOHtVhu JIdMmb8izusze3ADr1+8s/kv1WpdrdWKti3H1cIo= 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.14 36/69] ALSA: seq: Fix OOB-reads from strlcpy Date: Mon, 15 Apr 2019 20:58:54 +0200 Message-Id: <20190415183732.149677444@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@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;