memcpy () : Access violation writing location

-1

I am getting Access violation writing location 0xB7066CBC while running this code.Unable to figure out whats going on, any suggestions?

int main(void)

{
unsigned int SIG = 0x00000000;
unsigned int *base = (unsigned int *)0xb7066CBC;
SIG = 0x5a5a5a5a;
memcpy(base ,&SIG, 4);
}

Here are the values I am getting when I encounter this failure.

&SIG 0x003bf7c0 {0x5a5a5a5a}
SIG  0x5a5a5a5a
base 0xb7066cbc {???}
exception
memory
segmentation-fault
memcpy
asked on Stack Overflow Oct 12, 2018 by aditya sharma

1 Answer

0

I am getting Access violation writing location 0xB7066CBC while running this code.Unable to figure out whats going on

What's going on is that the 4 bytes at location 0xB7066CBC are not writable.

Your problem most likely lies in whatever reasoning led you to believe that these bytes are (or should be) writable, but since you didn't provide any clue as to what that reasoning might be, it's hard to offer any help.

answered on Stack Overflow Oct 14, 2018 by Employed Russian

User contributions licensed under CC BY-SA 3.0