Calling ns_mktemp (naviserver-4.99.13) with a template string will result in an alloc error and server crash.
E.g.:
ns_mktemp "/tmp/test-XXXXXX"
Fatal: alloc: invalid block: 0x7f5754452300: 20 27
I had a look in the file "tclfile.c" and function "NsTclMkTempObjCmd". Problem was caused by following line of code:
char *buffer = strdup(templateString);
Change it to:
char buffer = ns_*strdup(templateString);
Now it works. Is there something wrong with my installation? Or is this a bug?
Thank you
Patrick, you are absolutely right. the bug was introduced in 4.99.13, not sure, where my mind was! will extend the regression test.
The bug is fixed on bitbucket
https://bitbucket.org/naviserver/naviserver/commits/df1ea009b8fa45b061965e9f7ea1a5dcca7bf806
Thanks for the quick fix.
The nasty part was, that the bug does not show up with our installations (and my test servers), which use a modified version of tcl based on SYSTEM_MALLOC (e.g. google perf tools). High, probably, we need a quick release, since the bug will hurt standard OpenACS sites.