mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
fix deviceName length (#2482), formatting
This commit is contained in:
@@ -975,7 +975,9 @@ void EMSESP::process_deviceName(std::shared_ptr<const Telegram> telegram) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char name[16];
|
char name[16];
|
||||||
uint8_t len = telegram->offset + telegram->message_length - 27;
|
// len including zero terminator, if there is one, otherwise copy to end of telegram
|
||||||
|
// https://github.com/emsesp/EMS-ESP32/discussions/2482#discussioncomment-12649817
|
||||||
|
uint8_t len = telegram->offset + telegram->message_length - 26;
|
||||||
strlcpy(name, (const char *)&telegram->message_data[27 - telegram->offset], len < 16 ? len : 16);
|
strlcpy(name, (const char *)&telegram->message_data[27 - telegram->offset], len < 16 ? len : 16);
|
||||||
char * c = name;
|
char * c = name;
|
||||||
while (isprint(*c)) {
|
while (isprint(*c)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user