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);
-- 
2.21.0

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to