Earlier quoted context omitted.
The footnote was very difficult to spot. Furthermore, I am not sure why not write out the complete code, even if the author knew the code was not correct, even when pointed out, it would have been very trivial to initialize the variable.
Because the author made a stylistic choice to publish slightly incomplete code to get to the point faster (and pointed that out in a footnote, which was just as easy to spot as the "bug"). The point of the essay is not a perfectly executed C program, it's to demonstrate code disassembly and reverse engineering. More attention on perfect C code means less attention (reader attention and author attention alike) on the…
A Gentle Primer on Reverse Engineering
21–30 of 64 posts
Re: A Gentle Primer on Reverse Engineering
#22First: great article. One nit, though. There's a subtle error in the main function: char* input; printf("Please input a word: "); scanf("%s", input); Local variables are not automatically initialized in C, and we never assign input to point to any particular block of memory. This means it's probably pointing off to some random location - basically whatever address happened to be sitting on the stack when main was cal…
The author addresses this in footnote #2. They're simplifying the C code to get to the point of the article faster.
A really simple fix would be just to use a character array.
Re: A Gentle Primer on Reverse Engineering
#23Earlier quoted context omitted.
Let's look at the source of stdbool.h: #define true 1 #define false 0 http://clang.llvm.org/doxygen/stdbool_8h_source.html
I know that sdtbool actually contains macros for defining true and false, but _Bool is a new type in C99 ... But it is in the standard, implemented by all major compilers, so it should be used for the sake of clarity. IMHO this: bool is_valid(char* password); is more clear than this: int is_valid(char* password);
Re: A Gentle Primer on Reverse Engineering
#24Earlier quoted context omitted.
I know that sdtbool actually contains macros for defining true and false, but _Bool is a new type in C99 ... But it is in the standard, implemented by all major compilers, so it should be used for the sake of clarity. IMHO this: bool is_valid(char* password); is more clear than this: int is_valid(char* password);
But here's the thing: in the assembly (the very essence of the essay), booleans are still represented as integers . Using a standard macro would obfuscate the path to getting to the payoff of being able to switch a single byte from 0 to 1 and crack the program, because the author would then have to explain macros and delve into a bunch of ancillary stuff.
Furthermore as the examples are given in C, it is implied that the reader needs to be familiar with the language, and as a consequence, knowing about macros, should be if not a given, then at least required.
Re: A Gentle Primer on Reverse Engineering
#25Earlier quoted context omitted.
Because the author made a stylistic choice to publish slightly incomplete code to get to the point faster (and pointed that out in a footnote, which was just as easy to spot as the "bug"). The point of the essay is not a perfectly executed C program, it's to demonstrate code disassembly and reverse engineering. More attention on perfect C code means less attention (reader attention and author attention alike) on the…
Regarding your last sentence. Reverse Engineering is a complex task, and obfuscation is but one of the many challenges a reverse engineer faces, granted malloc/free or stack variable and the example binary not being one of them.
Re: A Gentle Primer on Reverse Engineering
#26Earlier quoted context omitted.
But here's the thing: in the assembly (the very essence of the essay), booleans are still represented as integers . Using a standard macro would obfuscate the path to getting to the payoff of being able to switch a single byte from 0 to 1 and crack the program, because the author would then have to explain macros and delve into a bunch of ancillary stuff.
Starting to work with Reverse Engineering assumes prior knowledge of programming and/or some basic information about assembly for the specific platform. Furthermore as the examples are given in C, it is implied that the reader needs to be familiar with the language, and as a consequence, knowing about macros, should be if not a given, then at least required.
Re: A Gentle Primer on Reverse Engineering
#27First: great article. One nit, though. There's a subtle error in the main function: char* input; printf("Please input a word: "); scanf("%s", input); Local variables are not automatically initialized in C, and we never assign input to point to any particular block of memory. This means it's probably pointing off to some random location - basically whatever address happened to be sitting on the stack when main was cal…
The author addresses this in footnote #2. They're simplifying the C code to get to the point of the article faster.
Re: A Gentle Primer on Reverse Engineering
#28Earlier quoted context omitted.
The author addresses this in footnote #2. They're simplifying the C code to get to the point of the article faster.
Simplifying does not mean incorrect. Initializing the variable would not add appreciable complexity to the code. It's a snippet and should be fixed lest it make the author appear incompetent.
Could they adjust the snippet? Sure. Will it add anything to the essay to do so? Nope.
Re: A Gentle Primer on Reverse Engineering
#29Earlier quoted context omitted.
I find it especially amusing because "poop" and "butts" are my default "I need to enter some text here" strings.
This is why we have [foo, bar, baz, quux] and example.com though: https://www.iana.org/domains/reserved
foo bar baz buz qux pip pop tut rof art uff dex dom zedRe: A Gentle Primer on Reverse Engineering
#30C lacks a boolean type This is false, as of C99 we have booleans in C, just include stdbool.h in your code, e.g.: #include ... bool test = true; ...
Let's look at the source of stdbool.h: #define true 1 #define false 0 http://clang.llvm.org/doxygen/stdbool_8h_source.html