‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length

13 篇文章 0 订阅

错误信息:

In function ‘AllocString’,
    inlined from ‘SetData’ at /home/yeqiang/Downloads/openjdk-jdk-14-23/src/java.desktop/share/native/liblcms/cmscgats.c:1586:47,
    inlined from ‘cmsIT8SetDataRowCol’ at /home/yeqiang/Downloads/openjdk-jdk-14-23/src/java.desktop/share/native/liblcms/cmscgats.c:2613:12:
/home/yeqiang/Downloads/openjdk-jdk-14-23/src/java.desktop/share/native/liblcms/cmscgats.c:1146:14: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
 1146 |     if (ptr) strncpy (ptr, str, Size-1);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/yeqiang/Downloads/openjdk-jdk-14-23/src/java.desktop/share/native/liblcms/cmscgats.c: In function ‘cmsIT8SetDataRowCol’:
/home/yeqiang/Downloads/openjdk-jdk-14-23/src/java.desktop/share/native/liblcms/cmscgats.c:1141:46: note: length computed here
 1141 |     cmsUInt32Number Size = (cmsUInt32Number) strlen(str)+1;
      |                                              ^~~~~~~~~~~

添加gcc编译参数 -Wno-stringop-truncation

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值