]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix check for a constant 0 argument to BPF_DIV.
authorGuy Harris <[email protected]>
Wed, 21 Apr 2010 09:20:48 +0000 (02:20 -0700)
committerGuy Harris <[email protected]>
Wed, 21 Apr 2010 09:20:48 +0000 (02:20 -0700)
BPV_RVAL() is the macro to check the type of the return value of a "ret"
instruction; it tests more bits than are appropriate for a "div"
instruction, and the test fails.

bpf/net/bpf_filter.c

index a51ed78756d40ddfd9ead0ac671af47b80bdcc2c..22aff79362076d98528883e4b14332e2595eb357 100644 (file)
@@ -608,7 +608,7 @@ bpf_validate(f, len)
                                /*
                                 * Check for constant division by 0.
                                 */
                                /*
                                 * Check for constant division by 0.
                                 */
-                               if (BPF_RVAL(p->code) == BPF_K && p->k == 0)
+                               if (BPF_SRC(p->code) == BPF_K && p->k == 0)
                                        return 0;
                                break;
                        default:
                                        return 0;
                                break;
                        default: