Skip to content

Feature/stm32 integration#69

Open
noorhaq wants to merge 3 commits into
mainfrom
feature/stm32_integration
Open

Feature/stm32 integration#69
noorhaq wants to merge 3 commits into
mainfrom
feature/stm32_integration

Conversation

@noorhaq
Copy link
Copy Markdown
Collaborator

@noorhaq noorhaq commented Apr 2, 2026

Adding Readme.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 2, 2026

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Warnings Elapsed time
❌ C clang-format 109 3648 0 14.3s
❌ EDITORCONFIG editorconfig-checker 356 1 0 1.22s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

uint8_t ch;

/* Prepare AT command */
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, (unsigned long)len);

Check warning

Code scanning / CodeQL

Too few arguments to formatting function Medium

Format for snprintf expects 3 arguments but given 2

Copilot Autofix

AI 2 months ago

In general, this type of problem is fixed by making the number and types of arguments passed to the formatting function match the format string’s conversion specifiers. Either you adjust the format string to match the arguments, or you add/remove arguments to match the format string as intended.

Here, the format string includes two %s placeholders and one %lu placeholder. The arguments being passed are name and (unsigned long)len. Given the function signature int ESP_UploadChunk(const char *name, const uint8_t *data, uint32_t len), it is reasonable to infer that the second %s is meant to represent some string related to the upload, likely the name again or perhaps something derived like a version or extension, but we have no other variable available in the snippet. The least invasive, clearly correct fix (without changing documented behavior) is to supply a third argument that matches the second %s placeholder. Since we cannot invent new state or change function semantics, the safest is to use name for both %s placeholders, i.e., change the call to:

snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, name, (unsigned long)len);

This preserves the existing format structure, satisfies the format specifiers, and does not require any new imports or definitions. The only line to change is line 250 in stm32/spotflow/network/esp_at.c.

Suggested changeset 1
stm32/spotflow/network/esp_at.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/stm32/spotflow/network/esp_at.c b/stm32/spotflow/network/esp_at.c
--- a/stm32/spotflow/network/esp_at.c
+++ b/stm32/spotflow/network/esp_at.c
@@ -247,7 +247,7 @@
     uint8_t ch;
 
     /* Prepare AT command */
-    snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, (unsigned long)len);
+    snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, name, (unsigned long)len);
 
     /* Send AT command */
     esp_send_raw(cmd);
EOF
@@ -247,7 +247,7 @@
uint8_t ch;

/* Prepare AT command */
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, (unsigned long)len);
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=2,\"%s\",\"%s.0\",7,%lu", name, name, (unsigned long)len);

/* Send AT command */
esp_send_raw(cmd);
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants