Programmer and hackers

xiaoxiao2021-03-06  41

Topic: There is a C class class a {int value; public: a (int n = 0): value (n) {} int getValue () {return value;}}; please use some way to the outside Change the value of the private member A :: Value. Programmer's possible practice: class a {int value; public: a (int N = 0): value (n) {} int getValue () {return value;} void setValue (int N) {value = n;}} Void f () {a a; a.setValue (5);} Hacker's possible practice: Void f () {a a; * ((int *) & a) = 5;} Conclusion: Programmer is accustomed to follow Some restrictions increase existing things. Hackers are used to using existing things to break existing restrictions.

转载请注明原文地址:https://www.9cbs.com/read-119406.html

New Post(0)