Skip to content

Bug #894 stop on --portmap syntax error#946

Merged
fklassen merged 1 commit into4.5.2-beta1from
Bug_#894_tcprewrite_portmap_syntax_crash
Jul 6, 2025
Merged

Bug #894 stop on --portmap syntax error#946
fklassen merged 1 commit into4.5.2-beta1from
Bug_#894_tcprewrite_portmap_syntax_crash

Conversation

@fklassen
Copy link
Copy Markdown
Member

@fklassen fklassen commented Jul 6, 2025

Example of fix:

❯ src/tcprewrite -r 1:2 -i ping.pcap -c ping.cache -o out.pcap
❯ src/tcprewrite -r 1-:2 -i ping.pcap -c ping.cache -o out.pcap

Fatal Error in ../../src/tcprewrite.c:main() line 86:
 Unable to parse args: From ../../../src/tcpedit/parse_args.c:tcpedit_post_args() line 189:
Unable to parse --portmap=1-:2

Standards checklist:

  • The PR title is descriptive.
  • The PR doesn't replicate another PR which is already open.
  • I have read the contribution guide and followed all the instructions.
  • The code follows the code style guide detailed in the wiki.
  • The code is mine or it's from somewhere with an MIT-compatible license.
  • The code is efficient, to the best of my ability, and does not waste computer resources.
  • The code is stable and I have tested it myself, to the best of my abilities.
  • If the code introduces new aliases, I provide a valid use case for all plugin users down below.

Changes:

  • stop and throw an error on --portmap syntax error

Example of fix:

```
❯ src/tcprewrite -r 1:2 -i ping.pcap -c ping.cache -o out.pcap
❯ src/tcprewrite -r 1-:2 -i ping.pcap -c ping.cache -o out.pcap

Fatal Error in ../../src/tcprewrite.c:main() line 86:
 Unable to parse args: From ../../../src/tcpedit/parse_args.c:tcpedit_post_args() line 189:
Unable to parse --portmap=1-:2
```
@fklassen fklassen changed the title Bug #94 stop on --portmap syntax error Bug #894 stop on --portmap syntax error Jul 6, 2025
@fklassen fklassen merged commit 71ade4d into 4.5.2-beta1 Jul 6, 2025
2 checks passed
@fklassen fklassen deleted the Bug_#894_tcprewrite_portmap_syntax_crash branch July 6, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant