You are calling strlen(NULL) in your function if NULL is the first argument. There is no guarantee how strlen() behaves if a NULL is passed, as strlen() doesn't check for NULL pointers. All strlen() does is start at the address you give it, and search for a '\0' character.

A NULL address is not the same thing as a '\0' character.

Regards,

Paul McKenzie
But my first argument will not be NULL, so I dont see the problem in this.