sshnet / sshnet/SSH.NET

Issue with NetConf : ArgumentOutOfRangeException

Aperta
#69 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Descrizione

When an rpc-reply message is received, this exception is thrown in NetconfSession.OnDataReceived event handler.
The cause is that the received data length is 1015 byte, and the decoded message string contains a magic number at the beginning as below:
#1585

....

This number is matched with a regex then is used to append this length of data to a stringbuilder, namely to _rpcreply object, like :

var match = Regex.Match(chunk.Substring(position), @"\n#(?<length>\d+)\n");
if (!match.Success)
{
  break;
}
var fractionLength = Convert.ToInt32(match.Groups["length"].Value);
_rpcReply.Append(chunk, position + match.Index + match.Length, fractionLength);

where the value of position is the number at the beginning of the message, that is, 1585 in this example.
It is obvious that the Append operation will fail as one can't append 1585 byte from an 1015 byte length string.

What I can't figure out is where this magic number is coming from, as RFC6241 apparently does not contain such - lets call it - segment length element ? So where is it coming from, can anyone tell ?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia in NetconfSession.OnDataReceived, concentrandoti sull’espressione regolare che legge il marker #length e sull’operazione di append di _rpcReply. Confronta questo framing con la specifica NETCONF pertinente e verifica come vengono suddivisi i chunk ricevuti. Il lavoro è completato quando viene identificata l’origine del marker e viene risolto l’errore out-of-range per il rpc-reply segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.