Actually you can just replace:
size_t strl = strnlen(element->name, sizeof(element->name));
element->name[sizeof(element->name)-1] = ‘\0’;
size_t strl = strlen(element->name);
I’ll do this in future versions of libmsym.
Technically this function is part of POSIX.1-2008, but I’ve seen it cause some issues with gcc compilers on OS X since it used to be a gnu extension.
Worked in computer security before, so I use strnlen out of habit to avoid potential buffer overflows.
On 02 Sep 2015, at 18:01, Louis Ricard [email protected] wrote:
I have been trying to compile the latest version on my old Mac (snowleopard 10.6.8).
My compiler (gcc 4.7.3 in Fink) lacks “strnlen” for some obscure reason.
I finally succeeded to by adding the following code (taken from gnuplot 5.0.0) in “elements.c”:
strnlen(const char *str, size_t n)
const char * stop = (char *)memchr(str, ‘\0’, n);
return stop ? stop - str : n;
There may be better ways …
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
Avogadro-devel mailing list