isimodem: gprs-context: properly null terminate cd->password

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));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
James Prestwood 2019-06-17 14:38:04 -04:00 committed by Denis Kenzior
parent 999cf73282
commit a6001c1153
1 changed files with 1 additions and 1 deletions

View File

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