Skip to content

Commit

Permalink
Robustify the EDID scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Jackson committed Dec 11, 2006
1 parent dd6d901 commit 9a80be3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions edid-decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ extract_edid(int fd)
{
struct stat buf;
unsigned char *ret1 = NULL, *ret2 = NULL;
unsigned char *start, *end, *c;
unsigned char *start, *c;
unsigned char *out = NULL;
int state = 0;
int lines = 0;
Expand All @@ -163,13 +163,12 @@ extract_edid(int fd)
/* I think it is, let's go scanning */
if (!(start = strstr(strstr(ret1, "EDID (in hex):"), "(II)")))
return ret1;
if (!(end = strstr(start, ": \n")))
return ret1;

for (c = start; c < end; c++) {
for (c = start; *c; c++) {
if (state == 0) {
/* skip ahead to the : */
c = strstr(c, ":");
if (!(c = strstr(c, ": \t")))
break;
/* and find the first number */
while (!isxdigit(c[1]))
c++;
Expand Down

0 comments on commit 9a80be3

Please sign in to comment.