common_functions.c: handle strlen() and strnlen() better