Hi, I am making the muggle plugin work with UTF-8 and have a little problem: since asprintf leads to segfaults if feeded with incorrect UTF-8 characters, I wanted to write a wrapper function which would then check the return value of asprintf. However I have a problem with the variable argument list and the va_* macros. Using gdb shows that, in the following example, in res=asprintf (strp, fmt, ap); ap is interpreted not as a list of arguments but as an integer. What is wrong here? BTW I am quite sure that vdr will sometimes coredump since it never checks the return value of asprintf. One suspect would be if somebody used a latin1 charset and had special characters like äöü in file names and then changes to utf-8 without converting file names to utf-8. If vdr then passes such a file name to asprintf, corrupted memory results. Might be difficult to debug remotely. #include <stdarg.h> #include <stdio.h> #include <string.h> int msprintf(char **strp, const char *fmt, ...) { va_list ap; int res; va_start (ap, fmt); res=asprintf (strp, fmt, ap); va_end (ap); } int main() { char *buffer; asprintf(&buffer,"test: %d\n",5); write(1,buffer,strlen(buffer)); free(buffer); msprintf(&buffer,"test: %d\n",5); write(1,buffer,strlen(buffer)); free(buffer); } -- Wolfgang _______________________________________________ vdr mailing list vdr@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr