=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/Attic/headers.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- src/usr.bin/aucat/Attic/headers.c 2010/05/27 06:17:04 1.16 +++ src/usr.bin/aucat/Attic/headers.c 2010/06/05 16:52:28 1.17 @@ -1,4 +1,4 @@ -/* $OpenBSD: headers.c,v 1.16 2010/05/27 06:17:04 ratchov Exp $ */ +/* $OpenBSD: headers.c,v 1.17 2010/06/05 16:52:28 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -186,7 +186,11 @@ return 0; } rsize = letoh32(riff.size); - while (pos + sizeof(struct wavchunk) <= rsize) { + for (;;) { + if (pos + sizeof(struct wavchunk) > rsize) { + warnx("missing data chunk"); + return 0; + } if (read(fd, &chunk, sizeof(chunk)) != sizeof(chunk)) { warn("wav_readhdr: chunk"); return 0;