Skip to content

Commit

Permalink
fixed issue in signature scan
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbo committed Apr 6, 2024
1 parent fadc1d7 commit 2f88eab
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/common/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ sig_to_pattern(lm_string_t signature, lm_byte_t **pattern_out, lm_char_t **mask_
return LM_FALSE;
}

if (alloc = realloc(mask, (bytecount + 1) * sizeof(lm_char_t))) {
if (alloc = realloc(mask, (bytecount + 2) * sizeof(lm_char_t))) {
mask = (lm_char_t *)alloc;
} else {
free(mask);
Expand All @@ -197,6 +197,7 @@ sig_to_pattern(lm_string_t signature, lm_byte_t **pattern_out, lm_char_t **mask_
if (pattern[bytecount] == 0 && ptr == endptr) {
endptr = strchr(&ptr[1], ' ');
mask[bytecount] = '?';
mask[bytecount + 1] = '\0';
} else {
mask[bytecount] = 'x';
}
Expand Down Expand Up @@ -225,6 +226,14 @@ LM_SigScan(lm_string_t signature,
if (!sig_to_pattern(signature, &pattern, &mask))
return match;

/* TODO: Delete */
printf("Parsed signature %s into:\n", signature);
for (size_t i = 0; i < strlen(mask); ++i) {
printf("%hhx", (unsigned char)pattern[i]);
}
printf("\n");
printf("%s\n", mask);

match = LM_PatternScan(pattern, mask, address, scansize);

free(pattern);
Expand Down

0 comments on commit 2f88eab

Please sign in to comment.