Redmine #5211: Detect broken strndup on AIX and provide workaround.

A more sensitive (and robust) test:
```
const char template[] = "string\0random cruft you shouldn't be able to see.";
s = strndup(template);
return memcmp(s + 7, template, sizeof(template) - 7) != 0;
```
Of course, it might also crash if the memcmp() reads past the end of the heap, but I consider this unlikely.  The malloc() arena comes in brk()-claimed pages and we don't have anything else in it, so the heap has plenty of room.