842 filename = dirname(filename);
843 if (screen.path)
844 free(screen.path);
845 screen.path = (char *)malloc(strlen(filename) + 1);
846 strcpy(screen.path, filename);
847 screen.path = strncat(screen.path, "/", 1);
This is it (in fact it is a classical one)!
strlen(filename) gives the length of filename EXCLUDING the trailing
\0. A buffer of size strlen(filename)+1 does have just enough space to
include the trailing \0. When appending "/", you write past the end of
that buffer. You have to change the +1 to a +2.
73, Mario
- --
Mario Klebsch mario@xxxxxxxxxx