Skip to content

Commit e917491

Browse files
committed
fix error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant] on MAC Xcode26.0
1 parent 4725ae5 commit e917491

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

client/src/cmdlfpac.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include "cmdlfem4x05.h" //
3636
#include "cliparser.h"
3737

38+
// 8 bytes + null terminator
39+
#define PAC_ID_LEN (8 + 1)
40+
3841
static int CmdHelp(const char *Cmd);
3942

4043
// PAC_8byte format: preamble (8 mark/idle bits), ascii STX (02), ascii '2' (32), ascii '0' (30), ascii bytes 0..7 (cardid), then xor checksum of cardid bytes
@@ -160,12 +163,13 @@ int demodPac(bool verbose) {
160163
uint32_t raw3 = bytebits_to_byte(g_DemodBuffer + 64, 32);
161164
uint32_t raw4 = bytebits_to_byte(g_DemodBuffer + 96, 32);
162165

163-
const size_t idLen = 9; // 8 bytes + null terminator
164-
uint8_t cardid[idLen];
166+
// 8 bytes + null terminator
167+
uint8_t cardid[PAC_ID_LEN];
165168
int retval = pac_buf_to_cardid(g_DemodBuffer, g_DemodBufferLen, cardid, sizeof(cardid));
166169

167-
if (retval == PM3_SUCCESS)
170+
if (retval == PM3_SUCCESS) {
168171
PrintAndLogEx(SUCCESS, "PAC/Stanley - Card: " _GREEN_("%s") ", Raw: %08X%08X%08X%08X", cardid, raw1, raw2, raw3, raw4);
172+
}
169173

170174
return retval;
171175
}

0 commit comments

Comments
 (0)