char msg = ""; //Speicher für die eingehende Nachricht
msg now only has one allocated byte
for (i = 0; i < buflen; i++)
msg[i] = buf[i];
... but you put what will likely be more than one byte in it.
if (msg == comp)
That's not how you compare strings. You can either use strcmp() with a null-terminated string (You'll have to explicitly null terminate it), or use memcmp() and compare the comp variable directly to buf.
char msg = "";
That's not how you empty a string. If you're using the strcmp() method, you need to set the first element to null:
msg = '\0';
If you're using the memcmp method, you have no need to reset it.