strcmp doesn't seem to work
You seem to already understand that it's not null-terminated and that's why it's not working the way you expect.  So, I'll take a different tact for &quot;how to fix it&quot;.
You can simply not treat the payload as a string, and instead use memcmp, as in:
if (length == 9 &amp;&amp; memcmp(payload, &quot;ravenclaw&quot;, 9) == 0) {

memcmp behaves similarly to strcmp, except that it isn't looking for a null terminator. It just compares however many bytes (chars) you specify.  In practice you may want to use a variable to hold &quot;ravenclaw&quot; and to strlen() on it rather than specifying the length separately as I've done above, e.g.:
static const char ravenclaw[] = &quot;ravenclaw&quot;;
static const size_t ravenclaw_len = sizeof ravenclaw - 1;
if (length == ravenclaw_len &amp;&amp; memcmp(payload, ravenclaw, ravenclaw_len) == 0) {

or any number of variations on that which might use strlen(), or a pointer rather than array (if not using sizeof) or PROGMEM with strlen_P() and memcmp_P() or... etc, etc, possibly putting this into a function so you can reuse it.

As a side note, if you know payload contains non-null-terminated text that you want to print, you can use the overload of write() that allows you to specify the length.
Serial.write(payload, length);