Actually, you should use the length returned from the call (len) to set the null. Change the null assignment to:
msg[len] = '\0';
Actually, you should use the length returned from the call (len) to set the null. Change the null assignment to:
msg[len] = '\0';