netbase: Use .data() instead of .c_str() on binary string

`.c_str()` is only guaranteed to return the data up to the first NUL
character.