Hi James,
On 06/17/2019 01:38 PM, James Prestwood wrote:
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);
Note that this doesn't null terminate call->address in all cases...
This file is full of these, so the sanest approach might be to use
l_strlcpy.
g_free(addr);
}
Regards,
-Denis