Skip to content

Commit 0dfe1e8

Browse files
committed
Move variable declaration to beginning of block
1 parent 944afa1 commit 0dfe1e8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

libyara/modules/pe.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,9 @@ void pe_parse_certificates(
12051205

12061206
if (serial_der != NULL)
12071207
{
1208+
unsigned char* serial_bytes;
1209+
char *serial_ascii;
1210+
12081211
bytes = i2d_ASN1_INTEGER(serial, &serial_der);
12091212

12101213
// i2d_ASN1_INTEGER() moves the pointer as it writes into
@@ -1213,7 +1216,7 @@ void pe_parse_certificates(
12131216
serial_der -= bytes;
12141217

12151218
// Skip over DER type, length information
1216-
unsigned char* serial_bytes = serial_der + 2;
1219+
serial_bytes = serial_der + 2;
12171220
bytes -= 2;
12181221

12191222
// Also allocate space to hold the "common" string format:
@@ -1224,7 +1227,7 @@ void pe_parse_certificates(
12241227
// The last one doesn't have the colon, but the extra byte is used
12251228
// for the NULL terminator.
12261229

1227-
char *serial_ascii = (char*) yr_malloc(bytes * 3);
1230+
serial_ascii = (char*) yr_malloc(bytes * 3);
12281231

12291232
if (serial_ascii)
12301233
{
@@ -1235,14 +1238,14 @@ void pe_parse_certificates(
12351238
// Don't put the colon on the last one.
12361239
if (j < bytes - 1)
12371240
snprintf(
1238-
(char*) serial_ascii + 3 * j, 4, "%02x:", serial_bytes[j]);
1241+
serial_ascii + 3 * j, 4, "%02x:", serial_bytes[j]);
12391242
else
12401243
snprintf(
1241-
(char*) serial_ascii + 3 * j, 3, "%02x", serial_bytes[j]);
1244+
serial_ascii + 3 * j, 3, "%02x", serial_bytes[j]);
12421245
}
12431246

12441247
set_string(
1245-
(char*) serial_ascii,
1248+
serial_ascii,
12461249
pe->object,
12471250
"signatures[%i].serial",
12481251
counter);

0 commit comments

Comments
 (0)