From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf van der Spek Subject: Re: [PATCH] Btrfs-progs use safe string manipulation functions Date: Thu, 10 Feb 2011 12:39:22 +0100 Message-ID: References: <1297081322.4615.10.camel@monotop> <4D53C711.3000309@nsc.liu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: linux-btrfs@vger.kernel.org To: Jeremy Sanders Return-path: In-Reply-To: List-ID: On Thu, Feb 10, 2011 at 12:37 PM, Jeremy Sanders wrote: > Olaf van der Spek wrote: > >> On Thu, Feb 10, 2011 at 12:08 PM, Thomas Bellman >> wrote: >>> strncpy(args.name, source, BTRFS_PATH_NAME_MAX); >>> args.name[BTRFS_PATH_NAME_MAX] = '\0'; >> >> That's silly. Isn't there a sane safe variant of strcpy? > > There's strlcpy, but it's not in glibc because of possible truncation > errors! Then use a private wrapper. -- Olaf