Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62336C433EF for ; Wed, 20 Apr 2022 20:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381917AbiDTUG5 (ORCPT ); Wed, 20 Apr 2022 16:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381910AbiDTUGy (ORCPT ); Wed, 20 Apr 2022 16:06:54 -0400 Received: from mxout03.lancloud.ru (mxout03.lancloud.ru [45.84.86.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E8F3DDC6 for ; Wed, 20 Apr 2022 13:04:04 -0700 (PDT) Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout03.lancloud.ru 5A21D20ED6DC Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: Re: [PATCH] usb: core: devices: use scnprintf() instead of sprintf() To: Greg Kroah-Hartman CC: References: From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: Date: Wed, 20 Apr 2022 23:04:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1907.lancloud.ru (fd00:f066::207) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Hello! On 4/20/22 9:40 AM, Greg Kroah-Hartman wrote: Thanks for the (unusually?) prompt reply! :-) >> The USB device dump code uses the sprintf() calls with a 2-page buffer, >> leaving 256 bytes at the end of that buffer to prevent buffer overflow. >> Using scnprntf() instead eliminates the very possibility of the buffer >> overflow, while also simplifying the code. This however is achieved at >> the expense of not printing the "(truncated)" line anymore when the end >> of that buffer is actually reached; instead a possible partial line at >> the end of buffer (not ending with '\n') is now not printed. > > So you just changed a user-visable abi :( debugfs is an ABI too? :-) > Please no, obviously that is not allowed. Oh, well... I'll prepare another patch then: some of the checks in this file are clearly redundant... > greg k-h MBR, Sergey