diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-03-23 22:18:57 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2022-03-28 20:50:38 +0200 |
commit | 2195f0c7dbfbf556071c44ed9565288c3978b6b9 (patch) | |
tree | 65a1b92ed732c0f3f2a9689680d322647c290337 | |
parent | 6b084b809f9e78e098803b0ffaad910e7c41faec (diff) | |
download | hardware_replicant_libsamsung-ipc-2195f0c7dbfbf556071c44ed9565288c3978b6b9.tar.gz hardware_replicant_libsamsung-ipc-2195f0c7dbfbf556071c44ed9565288c3978b6b9.tar.bz2 hardware_replicant_libsamsung-ipc-2195f0c7dbfbf556071c44ed9565288c3978b6b9.zip |
partitions: android: silence compiler warning
Without that fix, when building the 'libsamsung-ipc' package through
scripts/guix.scm, we have the following warning:
CC partitions/android/android.lo
partitions/android/android.c:
In function ‘open_android_modem_partition_by_name’:
partitions/android/android.c:87:3: warning:
‘strncpy’ specified bound depends on the length of
the source argument [-Wstringop-overflow=]
87 | strncpy(path, partitions_dirnames[i],
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88 | strlen(partitions_dirnames[i]));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC partitions/toc/toc.lo
CCLD libsamsung-ipc.la
The warning is hamless because:
- The source (partitions_dirnames[i]) is hardcoded.
- The desitination buffer size was allocated more space than
the length of partitions_dirnames[i].
However it's good to silence non problematic warnings in order to
better detect really serious issues.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | samsung-ipc/partitions/android/android.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/samsung-ipc/partitions/android/android.c b/samsung-ipc/partitions/android/android.c index 9ec6ed4..9d2322f 100644 --- a/samsung-ipc/partitions/android/android.c +++ b/samsung-ipc/partitions/android/android.c @@ -84,8 +84,7 @@ int open_android_modem_partition_by_name(struct ipc_client *client, return -errno; } - strncpy(path, partitions_dirnames[i], - strlen(partitions_dirnames[i])); + strcpy(path, partitions_dirnames[i]); strcat(path, name); ipc_client_log(client, "%s: Trying to open %s", |