Date: Tue, 19 Dec 2000 21:54:14 +0000 From: Ben Smithurst <ben@FreeBSD.org> To: Warner Losh <imp@village.org> Cc: audit@FreeBSD.ORG Subject: Re: printf(1) broken for some long format strings Message-ID: <20001219215413.H78749@strontium.scientia.demon.co.uk> In-Reply-To: <200012191729.eBJHTps36903@billy-club.village.org> References: <20001219143506.C78749@strontium.scientia.demon.co.uk> <200012191729.eBJHTps36903@billy-club.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Warner Losh wrote: > if (len > copy_size) { > if (copy_size == 0) > newlen = 1024; what's the point of the special case for copy_size == 0? And that would break if more than 1k is needed the first time through, wouldn't it? (Or maybe I'm just not thinking straight at the moment.) Why not just use > newlen = ((len + 1023) >> 10) << 10; every time? > might be a little better. It will round the size to the next highest > k boundary, which will result in fewer malloc calls. A slightly > better way would be to find some way to round it up to the next power > of 2 so that you do even fewer malloc calls, but my bit tiddling foo > isn't awake yet this morning. that's probably over the top, since the maximum length before this change was 64 bytes, there can't be many places where more than that is needed or someone would have noticed this and fixed it before me. :-) -- Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001219215413.H78749>