This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit e19d99022a426629a40d3b22b0b053f013e4badb
Author: yangsong8 <[email protected]>
AuthorDate: Fri Aug 1 15:25:06 2025 +0800

    apps/fastboot: fix build warning
    
    apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be 
truncated writing up to 63 bytes into a region of size 60 
[-Werror=format-truncation=] ...... apps/system/fastboot/fastboot.c:351:3: 
note: 'snprintf' output between 5 and 68 bytes into a destination of size 64 | 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
apps/system/fastboot/fastboot.c:351:43: error: '%s' directive output may be 
truncated writing up to 63 bytes into a region of size 60 [-Werror [...]
    
    Signed-off-by: yangsong8 <[email protected]>
---
 system/fastboot/fastboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c
index 41e20b6d8..4ba39b5d3 100644
--- a/system/fastboot/fastboot.c
+++ b/system/fastboot/fastboot.c
@@ -352,14 +352,14 @@ static int fastboot_write(int fd, FAR const void *buf, 
size_t len)
 static void fastboot_ack(FAR struct fastboot_ctx_s *ctx,
                          FAR const char *code, FAR const char *reason)
 {
-  char response[FASTBOOT_MSG_LEN];
+  char response[FASTBOOT_MSG_LEN + 4];
 
   if (reason == NULL)
     {
       reason = "";
     }
 
-  snprintf(response, FASTBOOT_MSG_LEN, "%s%s", code, reason);
+  snprintf(response, FASTBOOT_MSG_LEN + 4, "%s%s", code, reason);
   ctx->ops->write(ctx, response, strlen(response));
 }
 

Reply via email to