GCC complains that the destination buffer equals the size to copy:

In function ‘strncpy’,
    inlined from ‘isi_call_any_address_sb_proc.isra.0’ at 
drivers/isimodem/voicecall.c:230:2:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ 
specified bound 20 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 drivers/isimodem/voicecall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 9a63f100..3fb150f6 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -227,7 +227,7 @@ static void isi_call_any_address_sb_proc(struct 
isi_voicecall *ivc,
 
        call->addr_type = type | 0x80;
        call->presentation = pres;
-       strncpy(call->address, addr, sizeof(call->address));
+       strncpy(call->address, addr, sizeof(call->address) - 1);
 
        g_free(addr);
 }
-- 
2.21.0

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

Reply via email to