ndisasm: handle the case of "no more sync points"

Handle the case of "no more sync points" explicitly, instead of saying
the next sync point is at UINT32_MAX.
This commit is contained in:
H. Peter Anvin 2007-11-20 13:22:58 -08:00
parent 2a15e69ebe
commit 49da468830
2 changed files with 3 additions and 3 deletions

View File

@ -259,7 +259,7 @@ int main(int argc, char **argv)
nextsync = next_sync(offset, &synclen);
do {
uint32_t to_read = buffer + sizeof(buffer) - p;
if (to_read > nextsync - offset - (p - q))
if (nextsync && to_read > nextsync - offset - (p - q))
to_read = nextsync - offset - (p - q);
if (to_read) {
lenread = fread(p, 1, to_read, fp);
@ -268,7 +268,7 @@ int main(int argc, char **argv)
} else
lenread = 0;
p += lenread;
if ((uint32_t)offset == nextsync) {
if (nextsync && (uint32_t)offset == nextsync) {
if (synclen) {
fprintf(stdout, "%08"PRIX32" skipping 0x%"PRIX32" bytes\n", offset, synclen);
offset += synclen;

2
sync.c
View File

@ -96,6 +96,6 @@ uint32_t next_sync(uint32_t position, uint32_t *length)
} else {
if (length)
*length = 0L;
return UINT32_MAX;
return 0;
}
}