J
js5895
hi,
when I move to the next entrie by adding to the pointers address, I'm
off by 6 bytes. Then I changed my code so my struct would have an
extra member, pad, and then it was off by 9 bytes. option and s are at
memory address 0x019f0176 when I add to it should be at 0x019f0179
instead I get 0x019f017f without pad and 0x019f0182 with pad. I can't
figure out why its always off.
struct option_entries {
unsigned char code;
unsigned char len;
unsigned char value;
unsigned char pad; //added later to check to see how much a new
member would offset it by.
};
const u_char *data;
option = (struct option_entries *)data;
s = (unsigned char *)option;
//option->len = 1
option = (option_entries *)s + option->len + 2;
when I move to the next entrie by adding to the pointers address, I'm
off by 6 bytes. Then I changed my code so my struct would have an
extra member, pad, and then it was off by 9 bytes. option and s are at
memory address 0x019f0176 when I add to it should be at 0x019f0179
instead I get 0x019f017f without pad and 0x019f0182 with pad. I can't
figure out why its always off.
struct option_entries {
unsigned char code;
unsigned char len;
unsigned char value;
unsigned char pad; //added later to check to see how much a new
member would offset it by.
};
const u_char *data;
option = (struct option_entries *)data;
s = (unsigned char *)option;
//option->len = 1
option = (option_entries *)s + option->len + 2;