This commit is contained in:
liyinong (A) 2021-01-26 17:39:18 +08:00
commit 0b72e68c79

View file

@ -11,7 +11,7 @@ device_read_info(socket_t device_socket, char *device_name, struct size *size) {
LOGE("Could not retrieve device information"); LOGE("Could not retrieve device information");
return false; return false;
} }
// in case the client sends garbage // in case the client sends garbage!
buf[DEVICE_NAME_FIELD_LENGTH - 1] = '\0'; buf[DEVICE_NAME_FIELD_LENGTH - 1] = '\0';
// strcpy is safe here, since name contains at least // strcpy is safe here, since name contains at least
// DEVICE_NAME_FIELD_LENGTH bytes and strlen(buf) < DEVICE_NAME_FIELD_LENGTH // DEVICE_NAME_FIELD_LENGTH bytes and strlen(buf) < DEVICE_NAME_FIELD_LENGTH