aboutsummaryrefslogtreecommitdiff
path: root/print-rx.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-05-25 16:14:54 -0700
committerGuy Harris <gharris@sonic.net>2020-05-25 16:14:54 -0700
commit6c89de6b90d43daf8a9d576cf07126f490cb0995 (patch)
tree6b2ac8bfcc7a8b7083e58d528e7eb5c6e83757fd /print-rx.c
parent4e7dd26c54d6c4e181b26f3691334951fffe6caf (diff)
downloadtcpdump-6c89de6b90d43daf8a9d576cf07126f490cb0995.tar.gz
afs/rx: try to suppress "conditional expression is constant" warnings
VECOUT() is always called with a constant argument; make that a characteristic, and declare the array to be of the proper size, so we don't need to do the test.
Diffstat (limited to 'print-rx.c')
-rw-r--r--print-rx.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/print-rx.c b/print-rx.c
index 65bc8218..5debd158 100644
--- a/print-rx.c
+++ b/print-rx.c
@@ -59,8 +59,8 @@
#define ERROR_RX_PORT 7006 /* Doesn't seem to be used */
#define BOS_RX_PORT 7007
-#define AFSNAMEMAX 256
#define AFSOPAQUEMAX 1024
+#define AFSNAMEMAX 256 /* Must be >= PRNAMEMAX + 1, VLNAMEMAX + 1, and 32 + 1 */
#define PRNAMEMAX 64
#define VLNAMEMAX 65
#define KANAMEMAX 64
@@ -854,13 +854,12 @@ rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh,
/*
* This is the sickest one of all
+ * MAX is expected to be a constant here
*/
#define VECOUT(MAX) { u_char *sp; \
- u_char s[AFSNAMEMAX]; \
+ u_char s[(MAX) + 1]; \
uint32_t k; \
- if ((MAX) + 1 > sizeof(s)) \
- goto trunc; \
ND_TCHECK_LEN(bp, (MAX) * sizeof(uint32_t)); \
sp = s; \
for (k = 0; k < (MAX); k++) { \