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=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 66320C433E0 for ; Sun, 28 Feb 2021 09:05:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F03364E4B for ; Sun, 28 Feb 2021 09:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbhB1JEr (ORCPT ); Sun, 28 Feb 2021 04:04:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbhB1JEn (ORCPT ); Sun, 28 Feb 2021 04:04:43 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D13C06174A; Sun, 28 Feb 2021 01:04:02 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id r25so14788384ljk.11; Sun, 28 Feb 2021 01:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Y3Uu/ZsgdYlP08kLSEVkeDEOcieYxfw0pQ354JPC2Q8=; b=IGC6oxBgqtzKuECaslYLe0rrGIsJ4UFxxy4GL4v/Zs8RE/qpumzSmXwsvH9mKfU7Uj dZEnVt3oVbN5duSQthBazjmPgd4/gXFuecaEtAHNWlRMGGTNiYJOrE+A/8ut47CupCet Iq5JjE0rSivojPuiG6oDZ1Vscq579fbYjoIy7ez2wwlFgK/lOGW2QSaOciDeRFAIlTpq Miak5nST3JWg/La8t9L4iAPOGqj03qI4rPHMMw5Lq18AWI9oZHYGjmzV5M0k1M9NxO6U i8ZTEnHYoEBcAL9gtm/pLqabb2ilr+FtUK+dX0qUE0U66Awq7ygP9TJHpiO93Z9rdm2c EaWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Y3Uu/ZsgdYlP08kLSEVkeDEOcieYxfw0pQ354JPC2Q8=; b=LKzOi9D5JpXeJiommoWkIwonBsy84Gj3f2G5N0YhUjSacWJaUPVF7px8EqmEoi1HTR WTYP+Fje8HvEl421BnXwzyXc/Oqql5vGeoAXp+76wUgfkQn5jxQVCNbDyTHsiVuf+ZsY LOh7buUM0Os1M8+ayMtGOC5wlK73dOHqb5ImTh2U0GyLrfVlbfuWK7woMPMFZ3s4M4iv XTOvAJxdsXdcUeY59EfeGbk3sz6URk0M5gDvDxlfdzYA7WGPSK2W5OKij07Tkm3aZ6TK zMNg7leELDcpaoTx7y79ei6Tm/FwugVB6MmGv+C56qa6OP4r15x1Up2nrtVoHjAZRbSu nMog== X-Gm-Message-State: AOAM5312jyqRoQHaPrxQR7P9enxc38MhndLvX01zDwSpN6gk1NtxsMMo L+a8wJwJMhek6IfE5CIjnbGqzpZ5YGOI/w== X-Google-Smtp-Source: ABdhPJwRbm12LrWwbcR6zUKZ9YTXpgi2ThJ1DGoXccMSMQ5SbAREgYAFsD/S4IzWXMwy+RvvMSRvTw== X-Received: by 2002:a05:651c:1318:: with SMTP id u24mr6298895lja.426.1614503038657; Sun, 28 Feb 2021 01:03:58 -0800 (PST) Received: from [192.168.1.100] ([31.173.86.90]) by smtp.gmail.com with ESMTPSA id a1sm2035353lji.22.2021.02.28.01.03.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Feb 2021 01:03:58 -0800 (PST) Subject: Re: [PATCH 19/20] usbip: usbip_host: Manual replacement of the deprecated strlcpy() with return values To: Romain Perier , Kees Cook , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , Valentina Manea , Shuah Khan , Shuah Khan Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210222151231.22572-1-romain.perier@gmail.com> <20210222151231.22572-20-romain.perier@gmail.com> From: Sergei Shtylyov Organization: Brain-dead Software Message-ID: <045eb376-f490-9608-6e54-68d39e83c3f9@gmail.com> Date: Sun, 28 Feb 2021 12:03:54 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210222151231.22572-20-romain.perier@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On 22.02.2021 18:12, Romain Perier wrote: > The strlcpy() reads the entire source buffer first, it is dangerous if > the source buffer lenght is unbounded or possibility non NULL-terminated. Length. Possibly? > It can lead to linear read overflows, crashes, etc... > > As recommended in the deprecated interfaces [1], it should be replaced > by strscpy. > > This commit replaces all calls to strlcpy that handle the return values > by the corresponding strscpy calls with new handling of the return > values (as it is quite different between the two functions). > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy > > Signed-off-by: Romain Perier [...] MBR, Sergei