modem: modem_cellular: CID 338164

strncpy() passed incorrect size

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
Bjarki Arge Andreasen 2024-02-12 17:10:19 +01:00 committed by Henrik Brix Andersen
parent 5517e22133
commit adcdf64a0f

View file

@ -337,7 +337,7 @@ static void modem_cellular_chat_on_cgmr(struct modem_chat *chat, char **argv, ui
return; return;
} }
strncpy(data->fw_version, argv[1], sizeof(data->fw_version)); strncpy(data->fw_version, argv[1], sizeof(data->fw_version) - 1);
} }
static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc, static void modem_cellular_chat_on_csq(struct modem_chat *chat, char **argv, uint16_t argc,