db_cassandra: clone key in a zero-termniated local buffer

- rework from a patch by Jay Binks