From a6001c1153b8beef99a6b432dc5c55ff325ca204 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 17 Jun 2019 14:38:04 -0400 Subject: [PATCH] isimodem: gprs-context: properly null terminate cd->password MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It looks like a previous line was copied and cd->username was re-terminated instead of password. This also fixes a compiler error when using GCC 9: In function ‘strncpy’, inlined from ‘isi_gprs_activate_primary’ at drivers/isimodem/gprs-context.c:546:3: /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ output may be truncated copying 53 bytes from a string of length 255 [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- drivers/isimodem/gprs-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c index 9ccc7f15..4076ed8b 100644 --- a/drivers/isimodem/gprs-context.c +++ b/drivers/isimodem/gprs-context.c @@ -544,7 +544,7 @@ static void isi_gprs_activate_primary(struct ofono_gprs_context *gc, strncpy(cd->username, ctx->username, GPDS_MAX_USERNAME_LENGTH); cd->username[GPDS_MAX_USERNAME_LENGTH] = '\0'; strncpy(cd->password, ctx->password, GPDS_MAX_PASSWORD_LENGTH); - cd->username[GPDS_MAX_PASSWORD_LENGTH] = '\0'; + cd->password[GPDS_MAX_PASSWORD_LENGTH] = '\0'; } cd->pep = g_isi_pep_create(cd->idx, NULL, NULL);