]> The Tcpdump Group git mirrors - tcpdump/commit
ppp: use the buffer stack for the de-escaping buffer.
authorGuy Harris <[email protected]>
Tue, 12 Mar 2024 07:37:23 +0000 (00:37 -0700)
committerGuy Harris <[email protected]>
Thu, 21 Mar 2024 19:53:36 +0000 (12:53 -0700)
commite9bff173f9833b5532f3b6dce8c049e955140169
tree6ed3a8ca0be902855248b8b81caf59e1afd14dea
parentc4fdecbc4dbd3c64dd28814d4317aee980531415
ppp: use the buffer stack for the de-escaping buffer.

This both saves the buffer for freeing later and saves the packet
pointer and snapend to be restored when packet processing is complete,
even if an exception is thrown with longjmp.

This means that the hex/ASCII printing in pretty_print_packet()
processes the packet data as captured or read from the savefile, rather
than as modified by the PPP printer, so that the bounds checking is
correct.

That fixes CVE-2024-2397, which was caused by an exception being thrown
by the hex/ASCII printer (which should only happen if those routines are
called by a packet printer, not if they're called for the -X/-x/-A
flag), which jumps back to the setjmp() that surrounds the packet
printer.  Hilarity^Winfinite looping ensues.

Also, restore ndo->ndo_packetp before calling the hex/ASCII printing
routine, in case nd_pop_all_packet_info() didn't restore it.

(cherry picked from commit b9811ef5bb1b7d45a90e042f81f3aaf233c8bcb2)
print-ppp.c
print.c