Skip to content

Commit e920d2e

Browse files
Copilotnetmindz
andcommitted
Complete OTA release compatibility system with comprehensive testing
Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
1 parent 54746c9 commit e920d2e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

wled00/ota_release_check.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@ bool extractReleaseNameFromBinary(const uint8_t* binaryData, size_t dataSize, ch
8686
for (int i = 0; releasePatterns[i] != NULL; i++) {
8787
pos = findStringInBinary(binaryData, scanSize, releasePatterns[i]);
8888
if (pos >= 0) {
89-
// Found a potential release name, extract full null-terminated string
90-
int len = extractNullTerminatedString(binaryData, scanSize, pos, extractedRelease, 64);
91-
if (len > 0) {
92-
DEBUG_PRINTF_P(PSTR("Found release name pattern: %s\n"), extractedRelease);
93-
return true;
89+
// Found a potential release name, but verify it's a standalone string
90+
// Check that it's null-terminated and not part of a longer string
91+
size_t patternLen = strlen(releasePatterns[i]);
92+
93+
// Verify the string is properly null-terminated
94+
if (pos + patternLen < scanSize && binaryData[pos + patternLen] == 0) {
95+
// Also check that it's not preceded by alphanumeric character (to avoid partial matches)
96+
if (pos == 0 || !isalnum(binaryData[pos - 1])) {
97+
strcpy(extractedRelease, releasePatterns[i]);
98+
DEBUG_PRINTF_P(PSTR("Found release name pattern: %s\n"), extractedRelease);
99+
return true;
100+
}
94101
}
95102
}
96103
}

0 commit comments

Comments
 (0)