modem: modem_cellular: CID 338067

incorrect size passed to strncpy()

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
Bjarki Arge Andreasen 2024-02-12 17:14:00 +01:00 committed by Henrik Brix Andersen
parent b668296a50
commit 080d51bb36

View file

@ -370,7 +370,7 @@ static void modem_cellular_chat_on_imsi(struct modem_chat *chat, char **argv, ui
{
struct modem_cellular_data *data = (struct modem_cellular_data *)user_data;
strncpy(data->imsi, (char *)argv[1], sizeof(data->imsi));
strncpy(data->imsi, argv[1], sizeof(data->imsi) - 1);
}
static bool modem_cellular_is_registered(struct modem_cellular_data *data)