From: Dave Neary (dave.neary at domain palamon.ie)
Date: Thu 03 May 2001 - 10:35:19 IST
kevin lyda wrote:
>
> On Wed, May 02, 2001 at 09:52:40PM +0100, Dave Neary wrote:
> > And my first instinct...
> > strcat(msg=strdup(strvar1),strvar2);
>
> actually the order of evaluation isn't the problem. you haven't allocated
> enough space for strvar2.
Yes, this too is an issue :) It had already been pointed out elsewhere,
though. But to be a pedant....
strcat((msg=strdup(strvar1),realloc(msg,strlen(msg)+strlen(strvar2)+1)==NULL?bad_stuff():1),strvar2);
still doesn't work because we can't be guaranteed in which order the
arguments will evaluate :)
Cheers,
Dave.
-- David Neary, E-Mail dave.neary at domain palamon.ie Palamon Technologies Ltd. Phone +353-1-634-5059
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:10:10 GMT