From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A50EC282CE for ; Wed, 24 Apr 2019 18:12:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F77520652 for ; Wed, 24 Apr 2019 18:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556129533; bh=GtY64T+JO5BDbWkofFFH4I+06tx8KPa/rlDWb5tELS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Kb3EQCUeadDT7sN2FpvcPdjCudxqbOLCA1fFH/AuGPJ+bOvQwnrF8iHI9C1RaatHU iNvPza69IRA9lFrKUXu25loYrTok/lSyyaPdKrgMkYCsS0nR3RHTblRfp1wtWHzJ6p oyqSK9/CrnXKwAb4f7zl+8oK2UFyf6DJVosEeFFw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387799AbfDXRNF (ORCPT ); Wed, 24 Apr 2019 13:13:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:37030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387766AbfDXRNE (ORCPT ); Wed, 24 Apr 2019 13:13:04 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 5425F218FE; Wed, 24 Apr 2019 17:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556125983; bh=GtY64T+JO5BDbWkofFFH4I+06tx8KPa/rlDWb5tELS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JI8xddKJwxzJv4zKwdVqU1Qe77/jHBtSVYUYomKe+qa6dnT3xnhegVbE2Gt3/XB/B Dugj5a7cCB6RLQhjI7YNyEqeKfpWagpvDCgzZFMi17lS0rJEBvCIs76HG6QErqivkJ 4FdRIkflW6qYEMFcfMCjsC8AiUUmem7CrcnyfLB0= 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 3.18 052/104] ALSA: seq: Fix OOB-reads from strlcpy Date: Wed, 24 Apr 2019 19:09:09 +0200 Message-Id: <20190424170901.848335532@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170839.996641496@linuxfoundation.org> References: <20190424170839.996641496@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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; @@ -1564,7 +1564,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)); queuefree(q); if (copy_to_user(arg, &info, sizeof(info))) @@ -1642,7 +1642,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;