Fix overflow in device name if argument is NULL

If the device name was an empty binary, a terminating NULL byte would
be written to device.data[-1].