GNS3 / GNS3/dynamips

gt_sdma_handle_rxqueue does not truncate the packet length correctly

Open
#247 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
405
Forks
99
Avg merge
3m
Merged PRs (30d)
1

Description

gt_sdma_handle_rxqueue truncates the value of pkt_len:
https://github.com/GNS3/dynamips/blob/804ae0cdc84df30dbeac9599b3827905b7e6adab/common/dev_gt.c#L1098-L1099

but the only use of pkt_len happens before that, in line 1094.

Possible consequence: a big packet might cause a buffer overflow (probably in the vm memory instead of dynamips itself)

Discovered while converting to rust.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in common/dev_gt.c at gt_sdma_handle_rxqueue, especially lines 1094 and 1098-1099 linked in the issue, and trace the order in which pkt_len is used and truncated. Done means the packet length is safely bounded before its use and large-packet handling no longer permits the reported buffer-overflow consequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.