You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
1.4 KiB

From 2a744c80fb0e8ec22c1b7d3656f7cbdcad2f3fef Mon Sep 17 00:00:00 2001
From: Mamoru TASAKA <mtasaka@fedoraproject.org>
Date: Mon, 28 Dec 2020 15:31:38 +0900
Subject: [PATCH 6/6] asm6502.c/newAsmLine: shut up -Wstringop warning
Shut up the following warning by gcc11 -Wall:
----------------------------------------------------------
In function 'strncpy',
inlined from 'newAsmLine' at ../../hacks/asm6502.c:1181:5,
inlined from 'parseAssembly' at ../../hacks/asm6502.c:1661:14,
inlined from 'compileCode' at ../../hacks/asm6502.c:2029:13:
/usr/include/bits/string_fortified.h:91:10: warning: 'strncpy' specified bound 80 equals destination size [-Wstringop-truncation]
----------------------------------------------------------
---
hacks/asm6502.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hacks/asm6502.c b/hacks/asm6502.c
index dd8a11b..28a85d1 100644
--- a/hacks/asm6502.c
+++ b/hacks/asm6502.c
@@ -1178,7 +1178,7 @@ static AsmLine *newAsmLine(char *cmd, char *label, BOOL decl, Param *param, int
newp = (AsmLine *) ecalloc(1, sizeof(AsmLine));
newp->labelDecl = decl;
newp->label = newLabel();
- strncpy(newp->label->label,label,MAX_LABEL_LEN);
+ sprintf(newp->label->label, "%.*s", MAX_LABEL_LEN - 1, label);
newp->command = estrdup(cmd);
newp->param = newParam();
copyParam(newp->param, param);
--
2.29.2