Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: PATCH: zasprintf
- X-seq: zsh-workers 12832
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Clint Adams" <schizo@xxxxxxxxxx>, <zsh-workers@xxxxxxxxxxxxxx>
- Subject: RE: PATCH: zasprintf
- Date: Mon, 18 Sep 2000 17:28:06 +0400
- Importance: Normal
- In-reply-to: <20000916145333.A29559@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
> +
> + *strp = buf;
> + return strlen(buf);
It is wrong IIRC in case of (v|)snprintf. snprintf may leave buffer not
NULL-terminated in case of overflow. Even worse is, that there seems to be no
standard return value to indicate overflow (some systems return -1; some
buffer length. There was very interesting comment from Mark Crispin on
c-client list recently). And some systems (mine including) do not even
document snprintf.
Somehow I agree with Bart - if we can avoid it, let's avoid it.
-andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author