Contribute
Register

Patcho, a simple hex binary patcher

Status
Not open for further replies.
Bug.

Patcho is overwriting the bounds of the argv array:
Code:
    if (embed[0] != '<' && argc == 1) {
        argv[1] = malloc(sizeof(embed));
        argv[2] = malloc(sizeof(embed));
        argv[3] = malloc(sizeof(embed));
        argv[4] = malloc(sizeof(embed));

If argc==1, then only argv[0] is valid.
argv[1...infinity] are outside the bounds of the array.
 
If you check the memory addresses of argv, this really isn't an issue, and you can confirm that by running it yourself. If you're really concerned, you could allocate another array on the stack, using it throughout, and remapping argv into it in the manually-entered case. Otherwise I wouldn't bother.
 
If you check the memory addresses of argv, this really isn't an issue,

Not portable. Also, I don't see how 'checking the memory addresses of argv' can help. Without seeing the source for the code that calls main, there is simply no way to verify that these memory addresses aren't being used for something else.

and you can confirm that by running it yourself. If you're really concerned, you could allocate another array on the stack, using it throughout, and remapping argv into it in the manually-entered case. Otherwise I wouldn't bother.

I fixed it in the version I use.
 
Hey there,


the patch doesn't work with mavericks or do i need any other things with a dq77kb, on ML works flawless.

thanks
 
Status
Not open for further replies.
Back
Top