Index: eagle_bin/test_parser/eagle_bin.c =================================================================== --- eagle_bin/test_parser/eagle_bin.c (revision 9421) +++ eagle_bin/test_parser/eagle_bin.c (revision 9422) @@ -1439,6 +1439,7 @@ unsigned char block[4]; int DRC_length_used = 244; unsigned char DRC_block[244]; + unsigned char c; int DRC_preamble_end_found = 0; if (fread(block, 1, 4, f) != 4) { @@ -1462,16 +1463,23 @@ } while (!DRC_preamble_end_found) { - if (fread(block, 1, 4, f) != 4) { /* the text preamble seems to n * 24 bytes */ + if (fread(&c, 1, 1, f) != 1) { /* the text preamble is not necessarily n * 4 bytes */ printf("E: short attempted DRC preamble read. Truncated file?\n"); return -1; + } else { + if (c == '\0') { /* so we step through, looking for each 0x00 */ + if (fread(block, 1, 4, f) != 4) { /* the text preamble seems to n * 24 bytes */ + printf("E: short attempted DRC preamble read. Truncated file?\n"); + return -1; + } + if (load_long(block, 0, 1) == 0x78 + && load_long(block, 1, 1) == 0x56 + && load_long(block, 2, 1) == 0x34 + && load_long(block, 3, 1) == 0x12) { + DRC_preamble_end_found = 1; + } + } } - if (load_long(block, 0, 1) == 0x78 - && load_long(block, 1, 1) == 0x56 - && load_long(block, 2, 1) == 0x34 - && load_long(block, 3, 1) == 0x12) { - DRC_preamble_end_found = 1; - } } printf("found end of DRC preamble text x78x56x34x12. About to load DRC rules.\n");