This commit is contained in:
Pin
2021-10-14 01:27:38 -04:00
parent 7534150326
commit 6166af2b41
4 changed files with 104 additions and 9 deletions

View File

@@ -123,7 +123,6 @@ int change_idat_content(unsigned char *addr, unsigned char *message, int accurac
int prop_found = 0;
long size = 1;
long rounds = 0;
size_t idat_byte_length = 0;
unsigned char* idat_data = calloc(size, sizeof(unsigned char));
for(size_t i = 0; i <= idat_length; i++) {
@@ -167,6 +166,8 @@ int main() {
FILE *fp;
size_t i = 0;
unsigned long offset = 0;
struct PNG_START_FILE_STRUCT png_start_file_data;
struct PNG_IDAT_FILE_STRUCT png_idat_file_data;
unsigned char *message = malloc(sizeof(char));
message[0] = '\0';
@@ -184,7 +185,13 @@ int main() {
unsigned char *file_data = file_to_char_array(fp, &i);
fclose(fp);
populate_start_png(file_data, &png_start_file_data);
offset = first_idat(file_data);
printf("Off: %ld\n", offset);
populate_idat_png(file_data, &png_idat_file_data, offset);
change_idat_content(file_data, message, 1, offset);
free(file_data);
free(message);