Tuesday, October 25, 2005

PalmOS bug?

It's a technical post... Don't read if you're not a programmer. :-)
I wanted to duplicate a string. I used:

StrCat(string, string);

this doesn't work. And let my program corrupt even storage heap, forcing a hard reset. Let's see.
If string is "Andre\0123456789", after the StrCat it becomes "AndreAndreA789", without the null terminator. This is because StrCat wanted to copy it from the source string, but when it did there was already an "A" in its place. This non-terminated string made the program corrupt the storage.
It's a PalmOS bug?

1 Comments:

Blogger Ignazio Di Napoli said...

The bug is in me. Standard Unix library doesn't handle overlaps for strcat.

12:57 PM  

Post a Comment

<< Home