]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
If clength gets real big (for some broken JBIG reason) then it can make i
authorLee Howard <faxguy@howardsilvan.com>
Thu, 1 Dec 2005 23:17:45 +0000 (23:17 +0000)
committerLee Howard <faxguy@howardsilvan.com>
Thu, 1 Dec 2005 23:17:45 +0000 (23:17 +0000)
"wrap" and makes problems for the loop.

faxd/CopyQuality.c++

index 0f1e1a824ad05c7d919f1b6f9851de2fe3f0bdea..d778aa54024f95bb7b74793026f807d4e260962f 100644 (file)
@@ -657,6 +657,7 @@ FaxModem::writeECMData(TIFF* tif, u_char* buf, u_int cc, const Class2Params& par
                            sdnormcount = 0;
                        }
                        u_long clength = 256*256*256*buf[i+2]+256*256*buf[i+3]+256*buf[i+4]+buf[i+5];
+                       if (clength > 256) clength = 256;               // keep it sane
                        fxStr comment = "";
                        for (u_long cpos = 0; i+6+cpos < cc && cpos < clength; cpos++) {
                            if (!isprint(buf[i+6+cpos])) break;         // only printables