So I have the following function defined in C:
#include <stdio.h>
void encrypt(int size, unsigned char *buffer){
buffer[i] = buffer[i] + 1;
printf("%c",buffer[i]);
}
int main(){
encrypt(5,"hello");
}
I'm expecting this to return ifmmp, but instead I get the error
"Segmentation fault (core dumped)".
If I get rid of the line
buffer[i] = buffer[i] + 1
and
printf("%c",buffer[i]+1)
then I get the desired result. But I would like to actually change the value stored in that address. How can I do this?
"hello"as it is a string literal and a constant . Usechar s[]="hello";as suggested by @cleblanc .size, not used. What'si, not used either. Back to drawing board there I guess.