Skip to content

SSH: fix _ComaStrField length calculation#5010

Merged
polybassa merged 1 commit into
secdev:masterfrom
ali-keys:fix-ssh-comastr
Jun 11, 2026
Merged

SSH: fix _ComaStrField length calculation#5010
polybassa merged 1 commit into
secdev:masterfrom
ali-keys:fix-ssh-comastr

Conversation

@ali-keys

@ali-keys ali-keys commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

AI-Assisted: yes (Claude Sonnet 4.6)

Hi everyone,

This PR fixes SSH _ComaStrField length calculation.

_ComaStrField is used in NameList which is used with SSHKexInit:

Reproduce:

from scapy.layers.ssh import SSHKexInit, NameList

kex = SSHKexInit(kex_algorithms=NameList(names=[b"curve25519-sha256"]))
SSHKexInit(bytes(kex))  # <- error
>>> bytes(NameList(names=[b"curve25519-sha256"]))
b'\x00\x00\x00\x01curve25519-sha256'
                 ^
                 |
         incorrect length

The current implementation considers names as list and not bytes and return 1 for length in this example.

AI-Assisted: yes (Claude Sonnet 4.6)
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.03%. Comparing base (ab3b1bb) to head (98b0232).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5010   +/-   ##
=======================================
  Coverage   80.02%   80.03%           
=======================================
  Files         384      384           
  Lines       95622    95624    +2     
=======================================
+ Hits        76526    76532    +6     
+ Misses      19096    19092    -4     
Files with missing lines Coverage Δ
scapy/layers/ssh.py 89.74% <100.00%> (+0.78%) ⬆️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@polybassa

Copy link
Copy Markdown
Contributor

Thanks for the PR

@polybassa polybassa merged commit ef642eb into secdev:master Jun 11, 2026
22 of 25 checks passed
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.

2 participants