Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2447150pxb; Sun, 28 Feb 2021 01:23:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaXcigs6aIhuISu73Wq4J0kslIY3ELi+boPCH6JVF9K0khF10eOoD17gwOYJpDoV0AjumA X-Received: by 2002:a05:6402:1d1a:: with SMTP id dg26mr4861012edb.266.1614504223820; Sun, 28 Feb 2021 01:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614504223; cv=none; d=google.com; s=arc-20160816; b=Ld2dYhfaeaeNQBNhUw8XcF328qSA1HiNDou69/265nLCLc9XsORuF86piv0XrR69xq 1hsASWlCSmTq7DrMHncqU9BUNBLcrSXufyS1Q78n0qbPBMzPci32KCUbe8npezyYqr04 0wvChNDSsn1lfGB9pM3FYl921ueyGUz5fmlD+0L/aKE3e7pJxNcAGIq6TvZLXTiY+pOk Dk7RIrj2a0yEQFVUIH47DmLnWkOjbuUAbDZHmCwaEwDqSbGVKHryav+iGThRwXXsCWqJ pCIMeQYPu9mbvpmsAB+A3WIMsUTOKzgcQbtiAj2SgM5RWQltkQZrKcKYALaqHJaiKeOf hoPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=Y3Uu/ZsgdYlP08kLSEVkeDEOcieYxfw0pQ354JPC2Q8=; b=jGHCV83dclowMUi6YxEEIAWJkMdXEldLjR82OTrOmKlpEpsYGKuJgRb/Lzp+1NEJV1 ijtL7ZiIvSjVlhppPlt+7Kk3ftSRaQFQbW5unzXGM1dsR7v+F6w7YPtaaMFpP22xJqps +y10xcB6T6ude04jZW6KxpqLEnIq69wnN3Tnsf9NTmPaqgT8sBXJ+D2S0noJ6Tmycelf kgJ87rKfsy6/jeZAnMkQdkpMxYO6loCEju+r67M1RH4mAnYkNPyge3WaGfApSK4KJhHo NSvUMg6EnKeD8MypLT4IYPkIm5dY2zY2uMIdGZy8RHpPTvz+blTdzS4UH+qME5wep1K9 5qUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IGC6oxBg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu13si8697627ejb.588.2021.02.28.01.23.06; Sun, 28 Feb 2021 01:23:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IGC6oxBg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbhB1JEp (ORCPT + 99 others); Sun, 28 Feb 2021 04:04:45 -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-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