Ignazio,

You wrote:
> It's a PalmOS bug?

No, the bug is in you. :-P  StrCat() is supposed to work like
the strcat() function in the standard C library of Unix.
It does not pretend to act sensibly if the two strings overlap:

STRCAT(3)                  Linux Programmer's Manual                 STRCAT(3)
NAME
       strcat, strncat - concatenate two strings
SYNOPSIS
       #include <string.h>
       char *strcat(char *dest, const char *src);
DESCRIPTION
       The  strcat()  function appends the src string to the dest string over-
       writing the `\0' character at the end of dest, and then adds  a  termi-
       nating  `\0'  character.   The  strings  may  not overlap, [...]

Not that it matters, but if you are using PODS, you can see that the
behavior is not specific to PalmOS by writing a little C program,

---- test.c --------
#include "string.h"

main()
{
        char *s = "Andre\0001234567";
        strcat(s,s);
}
---------------------

and compiling it from the Cygwin command line and running it:

$ cc test.c
$ a.exe
Segmentation fault (core dumped)

Jay Ts
-- 
The most potent weapon in the hands of the
oppressor is the mind of the oppressed.
        -- Steve Biko

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to