I Hacked pawn memory
#1

Atleast it seems so. The only thing here is to see what perspective it gives, but as for now, so that you can take a look at it :
pawn Код:
enum cmp {
    a[34],
    b[54],
    c[54]
};
new Obj[cmp];
main(){
    new String[10];
    String="HACKED";
    //x=&String;
    new y[1][1];
    new z[1][1];
    //Next level :
    new v[1][1][1];
    hack2(y,String);
    hack2(z,y[0]);
    hack2(v[0],z[0]);
    //hack2(Obj[a][0],String);
    printf("HACK : %s >> %s",Obj,String);
    printf("HACK * : %d ||%s _ %s ;;",y,y,y[0],String);
    printf("HACK * : %d ||%s _ %s ;;",z,z,z[0],String);
    printf("HACK ** : %d %d ||%s _ %s _ %s ;;",v,v[0],v,v[0],v[0][0]);
    //Obj=String;
}
hack2(vect1[][],vect2[]) {
    format(vect1[0],32768,"[I can hack pawn!] : %s",vect2);
    return 0;
}
This results for me like this :
Код:
[17:40:48] HACK :  >> n hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED
[17:40:48] HACK * : 99 ||can hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED _ 
[17:40:48] HACK * : 73 ||I can hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED _ 
[17:40:48] HACK ** : 4 4 ||[I can hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED _ [I can hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED _ [I can hack pawn!] : [I can hack pawn!] : [I can hack pawn!] : HACKED ;;
[17:40:48] Script[gamemodes/tert.amx]: Run time error 6: "Invalid instruction"
Notes for this : string has been corrupted, printing an multi-dimensional array (basically the next dimension after normal strings) as %d results in somewhat... pointer?

Why can I say that I have really hacked pawn memory - I put a string of >10 chars into an array with the size of 1.
Note when testing code : I haven't really figured out where it gets error.

Just to add, it seems that it's able to drift off into other variables, and right now it'd be good to figure this out.

If it has been done, please explain why does this crash, and corrupt memory!
Reply
#2

The thing I'm interested in is how to manipulate that to use an array as an pointer, and the fact that this doesn't crash.

Edit : Another thing that is interesting is those (char)4 = diamonds appearing when giving char ** instead of char * to printf, I can't explain them in any way.
Reply
#3

hack2(vect1[],vect2[]) {
//format(vect1[0],32768,"[I can hack pawn!] : %s",vect2);
memcpy(vect1,vect2,0,1024 , 1024);
return 0;
}
Is still valid with 2dimensional arrays (and then it again becomes invalid).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)