mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-27 15:02:41 +00:00
Update src/graphics/draw/NodeListRenderer.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
7640caa053
commit
78ee8b1d37
@ -91,8 +91,14 @@ const char *getSafeNodeName(OLEDDisplay *display, meshtastic_NodeInfoLite *node)
|
|||||||
nodeName[strlen(nodeName) - 1] = '\0';
|
nodeName[strlen(nodeName) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we actually truncated, append "..."
|
// If we actually truncated, append "..." (ensure space remains in buffer)
|
||||||
if (strlen(nodeName) < origLen) {
|
if (strlen(nodeName) < origLen) {
|
||||||
|
size_t len = strlen(nodeName);
|
||||||
|
size_t maxLen = sizeof(nodeName) - 4; // 3 for "..." and 1 for '\0'
|
||||||
|
if (len > maxLen) {
|
||||||
|
nodeName[maxLen] = '\0';
|
||||||
|
len = maxLen;
|
||||||
|
}
|
||||||
strcat(nodeName, "...");
|
strcat(nodeName, "...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user