I prefer don't having a embedded strndup call, but rather have it as a part of the line above, so
char *c = strndup(...)