Repository navigation
Conversation
WriteResponse has no default member initialisers and both write handlers assigned status on only one branch, so the other returned uninitialised stack memory to the client over BLE: - commands::WRITE assigned status only on success, so a failed FileOpen reported garbage. The ternary was also dead code, as res is known to be 0 inside that branch. - commands::WRITE_DATA assigned status only on failure, so every successful chunk reported garbage, which readily looks like a negative LittleFS error code. Value-initialise both, matching DelResponse, MKDirResponse and ListDirResponse in the same file, and assign status on both paths. The visible symptom is a companion app reporting a file transfer error against a watch that is writing the file correctly.
|
Build size and comparison to main:
|
|
Note: |
|
This PR actually fixed resources update via Gadgetbridge. Also the existing code has a ternary if inside an @mark9064, @NeroBurner Could it be possible for you to review and merge this? |
| resp.status = (res == 0) ? 0x01 : (int8_t) res; | ||
| resp.status = 0x01; | ||
| } else { | ||
| resp.status = (int8_t) res; |
There was a problem hiding this comment.
Althoug the original had a c stype cast I prever to have C++ style static_cast here please
|
@NeroBurner I have contacted @JoeStrout via e-mail and he mentioned he probably couldn't get to this until the I have created #2500 which is this exact commit (cherry-picked) with your suggestion (amended). I hope this is OK! |
|
Closing this as #2500 has merged - thanks both |
WriteResponse has no default member initialisers and both write handlers assigned status on only one branch, so the other returned uninitialised stack memory to the client over BLE:
This change value-initialises both, matching DelResponse, MKDirResponse and ListDirResponse in the same file, and assign status on both paths.
The visible symptom is a companion app (like InfiniTimeExplorer) reporting a file transfer error ("Error creating file [0]") even when writing the file correctly.