Skip to content

Fix segfaults due to strict ISO C99 mode enforcement

Commit 7cc63be3 ("Makefile: Add support for POSIX make) changed the compilation mode to strict ISO C99 (-std=c99), which removed the declarations of strdup and strcasecmp. As the implicit return value is int instead of char*, the upper address bytes are discarded on e.g. x86_64 (sizeof(int) == 4), the resulting code crashes.

Add the declarations back by using Posix 2008 mode, and also include strings.h where required for strcasecmp.

Compilation may still fail when the compiler binary is not available as c99, .POSIX mode sets CC=c99. Use e.g. "CC=cc make all" to circumvent.

Merge request reports