From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbcCHXHb (ORCPT ); Tue, 8 Mar 2016 18:07:31 -0500 Received: from mail-io0-f172.google.com ([209.85.223.172]:33995 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbcCHXHY (ORCPT ); Tue, 8 Mar 2016 18:07:24 -0500 MIME-Version: 1.0 In-Reply-To: <1457469654-17059-1-git-send-email-linux@rasmusvillemoes.dk> References: <1457469654-17059-1-git-send-email-linux@rasmusvillemoes.dk> Date: Tue, 8 Mar 2016 15:07:23 -0800 X-Google-Sender-Auth: tY9XWZjBuzLhebjrIis1NiifGgM Message-ID: Subject: Re: [RFC 0/7] eliminate snprintf with overlapping src and dst From: Kees Cook To: Rasmus Villemoes Cc: Andrew Morton , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 8, 2016 at 12:40 PM, Rasmus Villemoes wrote: > Doing snprintf(buf, len, "%s...", buf, ...) for appending to a buffer > currently works, but it is somewhat fragile, and any other overlap > between source and destination buffers would be a definite bug. This > is an attempt at eliminating the relatively few occurences of this > pattern in the kernel. Can we add a gcc plugin to detect these and refuse to compile when they're found? -Kees -- Kees Cook Chrome OS & Brillo Security