Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262283AbTK1OFA (ORCPT ); Fri, 28 Nov 2003 09:05:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262288AbTK1OFA (ORCPT ); Fri, 28 Nov 2003 09:05:00 -0500 Received: from natsmtp00.rzone.de ([81.169.145.165]:31411 "EHLO natsmtp00.webmailer.de") by vger.kernel.org with ESMTP id S262283AbTK1OE6 (ORCPT ); Fri, 28 Nov 2003 09:04:58 -0500 Message-ID: <3FC75603.6020808@softhome.net> Date: Fri, 28 Nov 2003 15:04:51 +0100 From: "Ihar 'Philips' Filipau" Organization: Home Sweet Home User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030927 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Russell King CC: Linux Kernel Mailing List Subject: Re: [PATCH 2.6]: IPv6: strcpy -> strlcpy References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1030 Lines: 29 Russell King wrote: > > That ends up writing uninitialised kernel data to (unprivileged) user > space. So would strcpy() used in that situation. > I used to use: char buf[MAX]; ... buf[MAX-1] = 0; /* zero terminate */ strncpy(buf, src, MAX-1); This is safe regarding both 0 termination and 0 padding rest of string. -- Ihar 'Philips' Filipau / with best regards from Saarbruecken. -- _ _ _ Because the kernel depends on it existing. "init" |_|*|_| literally _is_ special from a kernel standpoint, |_|_|*| because its' the "reaper of zombies" (and, may I add, |*|*|*| that would be a great name for a rock band). -- Linus Torvalds - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/