Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1720975ybe; Sat, 7 Sep 2019 01:23:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqweeHshhFRo/yxLYsl7dAK4uvhgHpaaz/eRA/D4ewd6vpu5NEFD7s4BfG5PktpvJKDqcaFq X-Received: by 2002:a17:902:465:: with SMTP id 92mr13274828ple.65.1567844592443; Sat, 07 Sep 2019 01:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567844592; cv=none; d=google.com; s=arc-20160816; b=lEe8q9wE83Cxfe0jJu3zD5tCSdDZOOqrHUcy+CrTQwrbMvr4gmMxhFTaMKN3Hv8zgR ovBr1tS+D5D8yFPd3NPNcQdCpPH5skyQ9BsGHoc5GISIbIYBZBcCx2raKiA06n3LJwY/ GdNv5AlTm73o88OsnSMHjRMmrIjOU0HxtYslnsrXGaj7IIrste5+V0/q+MSSryToK3Fq Ullq0gmn+UbxM1A42WD9WLsmmHN60rTnpRNNbbMJcX2qmTuaedvUutifOpzp1dBiKA1x J5V4bp0mtVEkWRhYu36YGWHRMmgGH5pfzt5fLBKkTq+Um2b9CqiE6SncwB69R+FT09yI EYog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=VH1ZILNqohndXjvxeWKzTEguahN3F+DE5ixkUlkKd4U=; b=pCFUdP/R4sETM6QhU/O/P7GCFF9ePW8b8FpBgbdozrtNoJsiooyL/wLSNPbJA+DXs1 lcUsyE9qWMTGSNp09QDtos5vyBQUJ4P8OQVgK8J2VplOse5FrqbxqFx3QVyL4iUUccnw tdNNeaCFoUCpXIGiA6IQ+Dpv6GeaL7GoP1UcrKaAJdVEUcLKUYlqO+MlCi0cIOBrlZ7D btcRxS+fwsM74ckj8GMJwNjDlpQJwVV8kD9wfqrQ9RjSCYrwyqlGjo0FkZ6LBiOAbyqi v7MpLLdCv1h1UwdMFpPm5e91tukTqUQyNSp+dOs8euRVAPGzvDrR8GrsULjuLFo/EtWD 8w+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K5oZjUdR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si6382834pgd.493.2019.09.07.01.22.56; Sat, 07 Sep 2019 01:23:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=K5oZjUdR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393023AbfIFPxk (ORCPT + 99 others); Fri, 6 Sep 2019 11:53:40 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40926 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732580AbfIFPxk (ORCPT ); Fri, 6 Sep 2019 11:53:40 -0400 Received: by mail-pf1-f194.google.com with SMTP id x127so4770085pfb.7 for ; Fri, 06 Sep 2019 08:53:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VH1ZILNqohndXjvxeWKzTEguahN3F+DE5ixkUlkKd4U=; b=K5oZjUdR+AueXYMxc6zWqN9dQhO2RFQ2uHbKjzsq8PhbAHDEh396m2IlJKbDbEkMOc +Ji+pZ6yOLVd/97BIp/lya9U1Hp3weRJmTSjT11r5gOzqfIktHsG5RX4FSEawW5ubcrM p3epOYj0VgvQOZe/k2jR2bCFl1AtUEQ5toHok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VH1ZILNqohndXjvxeWKzTEguahN3F+DE5ixkUlkKd4U=; b=kIYsIOmN1DcE5T/kSMnHX4JTSRtTI4NdaVtoBOZWAPx2zgiRikuIA9/NFUHePzwmeQ XftZ1P2/PFxhOwB3ypCwgW0atfbEkkpcvZdaUky97NR4yo1hIkdpoXYa/nBdalJejH4g EUfi88jn/bfae8m1SIZYBDG0Oi++GiZucAPvvNc4XrNUYVDTf8f1kDXrUtPtNjbf8QV6 6P9Co/Czf7vClg/mfBKQdOabMj+NlwxV2wTWeHpTHo08gK/qTIkvNiNIi/23FNzU1Ljh ABYHe0WfChLvEHUrVadyjJ6txdROilkWtGxxv/PSf6O4IEB1QbKzE1x5NJm+aGufpgBp kL+Q== X-Gm-Message-State: APjAAAUDBzre2kvdf1TnZR17OxDr5bA4LdsHNP72wI5gN9MCTILN6pIn ZjGKoJ5o4rMo7LZusDfDfV5H7g== X-Received: by 2002:a17:90a:c587:: with SMTP id l7mr10128760pjt.25.1567785219552; Fri, 06 Sep 2019 08:53:39 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r23sm6101830pjo.22.2019.09.06.08.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 08:53:38 -0700 (PDT) Date: Fri, 6 Sep 2019 08:53:37 -0700 From: Kees Cook To: Andy Shevchenko Cc: "J. Bruce Fields" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/9] rtl8192*: display ESSIDs using %pE Message-ID: <201909060851.36ACDB23A@keescook> References: <20190905193604.GC31247@fieldses.org> <1567712673-1629-1-git-send-email-bfields@redhat.com> <201909051352.89D121A4@keescook> <20190906093829.GK2680@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906093829.GK2680@smile.fi.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 12:38:29PM +0300, Andy Shevchenko wrote: > On Thu, Sep 05, 2019 at 01:53:43PM -0700, Kees Cook wrote: > > On Thu, Sep 05, 2019 at 03:44:25PM -0400, J. Bruce Fields wrote: > > > From: "J. Bruce Fields" > > > > > > Everywhere else in the kernel ESSIDs are printed using %pE, and I can't > > > see why there should be an exception here. > > > > I would expand this rationale slightly: using "n" here makes no sense > > because they are already NUL-terminated strings. The "n" modifier could > > only be used with string_escape_mem() which takes a "length" argument. > > SSID may have NUL in any location in the name. Oops, you're totally right: I forgot the "*" part here. Ignore my comment. :) So, instead, this "upgrades" the escaping from "only NULL" to all the unprintables. > > > > - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid); > > > + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid); > > > > - snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid); > > > + snprintf(escaped, sizeof(escaped), "%*pE", essid_len, essid); > > -- > With Best Regards, > Andy Shevchenko > > -- Kees Cook