Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

injector: fix array initializer #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rupran
Copy link

@rupran rupran commented Jul 28, 2017

The struct insn_ts .bytes member is an array of length
MAX_INSN_LENGTH, which is #define'd to 15 in line 179 of injector.c.

The initialization of total_range in line 320 (which is of type
range_t, starring two members (.start and .end) of type insn_t,
however, uses 16 bytes for the initialization of the .bytes arrays.

Fix it by removing one element from the initializations.

Fixes (parts of) #2, #3 and #5.

The struct insn_t's .bytes member is an array of length
MAX_INSN_LENGTH, which is #define'd to 15 in line 179 of injector.c.

The initialization of total_range in line 320 (which is of type
range_t, starring two members (.start and .end) of type insn_t,
however, uses 16 bytes for the initialization of the .bytes arrays.

Fix it by removing one element from the initializations.
@@ -318,8 +318,8 @@ typedef struct { insn_t start; insn_t end; bool started; } range_t;
insn_t* range_marker=NULL;
range_t search_range={};
range_t total_range={
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
.end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},
.start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for writing out all those zeros?
Why not simply:

.bytes = {0, }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants