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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 CEF5DC10DCE for ; Sun, 15 Mar 2020 10:17:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3A5A2072A for ; Sun, 15 Mar 2020 10:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728159AbgCOKR5 (ORCPT ); Sun, 15 Mar 2020 06:17:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:36908 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728141AbgCOKR4 (ORCPT ); Sun, 15 Mar 2020 06:17:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C8E22ACA4; Sun, 15 Mar 2020 10:17:55 +0000 (UTC) Date: Sun, 15 Mar 2020 11:17:55 +0100 Message-ID: From: Takashi Iwai To: Jonathan Cameron Cc: linux-iio@vger.kernel.org Subject: Re: [PATCH 1/2] iio: core: Use scnprintf() for avoiding potential buffer overflow In-Reply-To: <20200315095446.4f2aa451@archlinux> References: <20200311074325.7922-1-tiwai@suse.de> <20200311074325.7922-2-tiwai@suse.de> <20200315095446.4f2aa451@archlinux> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Sun, 15 Mar 2020 10:54:46 +0100, Jonathan Cameron wrote: > > On Wed, 11 Mar 2020 08:43:24 +0100 > Takashi Iwai wrote: > > > Since snprintf() returns the would-be-output size instead of the > > actual output size, the succeeding calls may go beyond the given > > buffer limit. Fix it by replacing with scnprintf(). > > Hmm. This is definitely in the somewhat theoretical bug category, but > given it can be called to print a list of values that is defined > in a driver, fair enough - it's good protection. > > I'm not going to rush this in given we don't have any drivers > that are known to run into this. Hence I've queued it up for > the togreg branch of iio.git targeting the merge window rather than > as a fix. Thanks, that's fine, the patches are just precautions. Takashi