Closed sgn closed 4 years ago
Right away. This is a nasty bug indeed.
I'm late to improve my own code, but I think those two line can be simplified to:
char *path = strdup(PREFIX"/share/"PACKAGE"/");
Working with Windows is ...
I should really re-learn my C stdlib, I didn't know such a thing existed.
Plus that line never runs on Windows, that's for POSIX.
That line can work in Windows, but with annoying warning.
I keep forgetting strdup(3)
because of it's POSIX not C.
Sure, but that #ifdef
includes only POSIX code, so it's perfectly fine.
strlen(3) will return length of input, not including terminating NUL character. And strcpy(3) will copy the included NUL character. Thus, we'll get buffer overflow for 1 character.
Fix it.