Message from C, C++ talks

July 2019

— Like i should do your work...

— Giving people fish or teaching them how to fish?

— Leave it if you don't like it

— There's no any single chat on the internet where people would write code for you, and I doubt you'd be accepted anywhere judging by the way you're acting yourself, thus your request about "write code for me please" would never be accepted

Message permanent page

— 

Hi, I have a question, i'm creating a simple program that checks for a password to pratise some C programming, but I get a Segmentation Fault in the fgets function but don't know why. The C code is this one:



#include <openssl/md5.h>
#include <stdio.h>
#include "md5.h"
#include "hex.h"

int main() {

char pass[30];
char *out;
char *out2;
printf("[=] Password: ");
fgets(pass, sizeof(pass), stdin); // HERE IS THE ERROR
out = md5crypt(pass);
out2 = hexencode(out);

if(strcmp(out2, "E492931E5DAA29C4B1FE5B4A924567DB") == 0) {

printf("[+] Access granted, use the password as flag!\n");
exit(1);

} else {

printf("[-] Try again!\n");

}

return 0;

}

— Because you have a buffer overflow in your program. you don't get segmentation fault if you input "abcdef"

Message permanent page

— I get overflow even if I input just an "a"

— Huh?

— Is pass longer than 29 characters?

— No

— $./md5crypt
[=] Password: d
Violación de segmento

— (Violacion de Segmento) = (Segmentation Fault) in spanish

— But how are you sure it's exactly fgets where the segfault is?

— Can we see md5crypt and hexencode?

— Cause I wrote a printf after it to test and I don't