Hi Paolo,
On Thu, May 17, 2012 at 9:37 PM, Paolo Tosco wrote:
> Dear Craig,
>
> if you read more carefully my post you will see I have *perfectly* clear
> the difference between the size of a structure and the length of the
> string. Using strncpy instead of strcpy is the first rule to avoid a
> My only worry is that the (char *)to parameter passed in has to be
> long enough to hold the (char*)from parameter. I assume it is.
>
> Craig
>
Clearly this was also the concern of the original author, who, to avoid
any assumption, decided to use strncpy to avoid buffer overflows. Simply
he/
Dear Craig,
if you read more carefully my post you will see I have *perfectly* clear
the difference between the size of a structure and the length of the
string. Using strncpy instead of strcpy is the first rule to avoid a
buffer overflow - strcpy is deprecated by all good programming
practic
Hi Paolo,
I think you (and the original author) have mixed up the size of the
structures with the length of the string. There's no need to do a sizeof()
or to define a constant OB_ATOM_TYPE_LENGTH.
Here's what I think is needed ... it's actually simpler than the original.
Just use strcpy() inste
Actually that sizeof in Translate (data.cpp) is plain wrong, since it
refers to sizeof(char *) which is 8 on a 64-bit OS and 4 on a 32-bit OS;
build the attached test.c with -m64 and -m32 and run to verify that:
$ gcc -m64 test.c -o test64
$ ./test64
This is really 6: 6
This is machine-dependen