flow-tools: Make zlib a build time dependency only.
[openwrt/svn-archive/archive.git] / net / flow-tools / patches / 070-extra_ftpdu_verify_debugging.patch
1 diff --git a/lib/ftdecode.c b/lib/ftdecode.c
2 index ff6b0cf..8884db9 100644
3 --- a/lib/ftdecode.c
4 +++ b/lib/ftdecode.c
5 @@ -122,8 +122,10 @@ int ftpdu_verify(struct ftpdu *ftpdu)
6 ret = -1;
7
8 /* enough bytes to decode the count and version? */
9 - if (ftpdu->bused < 4)
10 + if (ftpdu->bused < 4) {
11 + fterr_warnx("not enough bytes to decode the count and version.");
12 goto ftpdu_verify_out_quick;
13 + }
14
15 ph = (struct ftpdu_header*)&ftpdu->buf;
16
17 @@ -158,15 +160,22 @@ #endif /* LITTLE_ENDIAN */
18 case 5:
19
20 /* max PDU's in record */
21 - if (ph->count > FT_PDU_V5_MAXFLOWS)
22 + if (ph->count > FT_PDU_V5_MAXFLOWS) {
23 + fterr_warnx("too many pdus (%d) in record, max %d", ph->count,
24 + FT_PDU_V5_MAXFLOWS);
25 goto ftpdu_verify_out;
26 + }
27 +
28
29 size = offsetof(struct ftpdu_v5, records) +
30 ph->count * sizeof (struct ftrec_v5);
31
32 /* PDU received size == PDU expected size? */
33 - if (size != ftpdu->bused)
34 + if (size != ftpdu->bused) {
35 + fterr_warnx("pdu received size was wrong. expected %d got %d",
36 + ftpdu->bused, size);
37 goto ftpdu_verify_out;
38 + }
39
40 ftpdu->ftv.d_version = 5;
41 ftpdu->decodef = fts3rec_pdu_v5_decode;
42 @@ -516,6 +525,7 @@ #endif /* LITTLE_ENDIAN */
43 break; /* 8 */
44
45 default:
46 + fterr_warnx("ftpdu version not set.");
47 goto ftpdu_verify_out;
48
49 } /* switch ph->version */