From owner-freebsd-hackers Thu Jul 15 17:26:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from rover.village.org (rover.village.org [204.144.255.49]) by hub.freebsd.org (Postfix) with ESMTP id 84C691577B for ; Thu, 15 Jul 1999 17:26:37 -0700 (PDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.9.3/8.9.3) with ESMTP id SAA29721; Thu, 15 Jul 1999 18:26:36 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.9.3/8.8.3) with ESMTP id SAA01181; Thu, 15 Jul 1999 18:26:36 -0600 (MDT) Message-Id: <199907160026.SAA01181@harmony.village.org> To: Mike Smith Subject: Re: OpenBSD's strlcpy(3) and strlcat(3) Cc: Paul Hart , Julian Elischer , freebsd-hackers@FreeBSD.ORG In-reply-to: Your message of "Thu, 15 Jul 1999 16:29:53 PDT." <199907152329.QAA01720@dingo.cdrom.com> References: <199907152329.QAA01720@dingo.cdrom.com> Date: Thu, 15 Jul 1999 18:26:36 -0600 From: Warner Losh Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <199907152329.QAA01720@dingo.cdrom.com> Mike Smith writes: : Ugh. Take the first example in the paper; it rewrites as : : len = asprintf(&path, "%s/.foorc"); : : as opposed to : : strlcat(path, homedir, sizeof(path)); : strlcat(path, "/", sizeof(path)); : strlcat(path, ".foord", sizeof(path)); : len = strlen(path); : : Yes, they're a better str*cat/cpy, but they're not the solution that : they claim to be. You've forgotten the free(path) sometime later in your code... That's a can of warms you conveniently ignore... And can be big problems for library routines whose API is defined to return stuff into a static buffer... Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message