File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,42 @@ func TestTimestampEnvConfig(t *testing.T) {
311
311
}
312
312
}
313
313
314
+ func TestClientVersionOverflow (t * testing.T ) {
315
+ var addr string
316
+ {
317
+ key , err := sshd .NewRandomSigner (512 )
318
+ if err != nil {
319
+ t .Fatal (err )
320
+ }
321
+ auth := NewAuth ()
322
+ config := sshd .MakeAuth (auth )
323
+ config .AddHostKey (key )
324
+
325
+ s , err := sshd .ListenSSH ("localhost:0" , config )
326
+ if err != nil {
327
+ t .Fatal (err )
328
+ }
329
+ defer s .Close ()
330
+ addr = s .Addr ().String ()
331
+ host := NewHost (s , nil )
332
+ go host .Serve ()
333
+ }
334
+
335
+ config := sshd .NewClientConfig ("foo" )
336
+ config .ClientVersion = strings .Repeat ("a" , 300 ) // 256 is overflow
337
+ conn , err := ssh .Dial ("tcp" , addr , config )
338
+ if err != nil {
339
+ t .Error (err )
340
+ }
341
+ defer conn .Close ()
342
+
343
+ session , err := conn .NewSession ()
344
+ if err != nil {
345
+ t .Error (err )
346
+ }
347
+ defer session .Close ()
348
+ }
349
+
314
350
func strptr (s string ) * string {
315
351
return & s
316
352
}
You can’t perform that action at this time.
0 commit comments