comparison cli-kex.c @ 1129:45830474d83c coverity

merge up to date, attempt to fix travis.yml
author Matt Johnston <matt@ucc.asn.au>
date Fri, 12 Jun 2015 23:02:15 +0800
parents 6aeadee3f16b
children 7fd1211a1f63
comparison
equal deleted inserted replaced
1077:26c1f9b8f82e 1129:45830474d83c
77 if (cli_ses.curve25519_param) { 77 if (cli_ses.curve25519_param) {
78 free_kexcurve25519_param(cli_ses.curve25519_param); 78 free_kexcurve25519_param(cli_ses.curve25519_param);
79 } 79 }
80 cli_ses.curve25519_param = gen_kexcurve25519_param(); 80 cli_ses.curve25519_param = gen_kexcurve25519_param();
81 } 81 }
82 buf_putstring(ses.writepayload, cli_ses.curve25519_param->pub, CURVE25519_LEN); 82 buf_putstring(ses.writepayload, (const char*)cli_ses.curve25519_param->pub, CURVE25519_LEN);
83 #endif 83 #endif
84 break; 84 break;
85 } 85 }
86 86
87 cli_ses.param_kex_algo = ses.newkeys->algo_kex; 87 cli_ses.param_kex_algo = ses.newkeys->algo_kex;
320 TRACE(("line is too short to be sensible")) 320 TRACE(("line is too short to be sensible"))
321 continue; 321 continue;
322 } 322 }
323 323
324 /* Compare hostnames */ 324 /* Compare hostnames */
325 if (strncmp(cli_opts.remotehost, buf_getptr(line, hostlen), 325 if (strncmp(cli_opts.remotehost, (const char *) buf_getptr(line, hostlen),
326 hostlen) != 0) { 326 hostlen) != 0) {
327 continue; 327 continue;
328 } 328 }
329 329
330 buf_incrpos(line, hostlen); 330 buf_incrpos(line, hostlen);
332 /* there wasn't a space after the hostname, something dodgy */ 332 /* there wasn't a space after the hostname, something dodgy */
333 TRACE(("missing space afte matching hostname")) 333 TRACE(("missing space afte matching hostname"))
334 continue; 334 continue;
335 } 335 }
336 336
337 if (strncmp(buf_getptr(line, algolen), algoname, algolen) != 0) { 337 if (strncmp((const char *) buf_getptr(line, algolen), algoname, algolen) != 0) {
338 TRACE(("algo doesn't match")) 338 TRACE(("algo doesn't match"))
339 continue; 339 continue;
340 } 340 }
341 341
342 buf_incrpos(line, algolen); 342 buf_incrpos(line, algolen);
344 TRACE(("missing space after algo")) 344 TRACE(("missing space after algo"))
345 continue; 345 continue;
346 } 346 }
347 347
348 /* Now we're at the interesting hostkey */ 348 /* Now we're at the interesting hostkey */
349 ret = cmp_base64_key(keyblob, keybloblen, algoname, algolen, 349 ret = cmp_base64_key(keyblob, keybloblen, (const unsigned char *) algoname, algolen,
350 line, &fingerprint); 350 line, &fingerprint);
351 351
352 if (ret == DROPBEAR_SUCCESS) { 352 if (ret == DROPBEAR_SUCCESS) {
353 /* Good matching key */ 353 /* Good matching key */
354 TRACE(("good matching key")) 354 TRACE(("good matching key"))
380 if (!cli_opts.always_accept_key) { 380 if (!cli_opts.always_accept_key) {
381 /* put the new entry in the file */ 381 /* put the new entry in the file */
382 fseek(hostsfile, 0, SEEK_END); /* In case it wasn't opened append */ 382 fseek(hostsfile, 0, SEEK_END); /* In case it wasn't opened append */
383 buf_setpos(line, 0); 383 buf_setpos(line, 0);
384 buf_setlen(line, 0); 384 buf_setlen(line, 0);
385 buf_putbytes(line, cli_opts.remotehost, hostlen); 385 buf_putbytes(line, (const unsigned char *) cli_opts.remotehost, hostlen);
386 buf_putbyte(line, ' '); 386 buf_putbyte(line, ' ');
387 buf_putbytes(line, algoname, algolen); 387 buf_putbytes(line, (const unsigned char *) algoname, algolen);
388 buf_putbyte(line, ' '); 388 buf_putbyte(line, ' ');
389 len = line->size - line->pos; 389 len = line->size - line->pos;
390 /* The only failure with base64 is buffer_overflow, but buf_getwriteptr 390 /* The only failure with base64 is buffer_overflow, but buf_getwriteptr
391 * will die horribly in the case anyway */ 391 * will die horribly in the case anyway */
392 base64_encode(keyblob, keybloblen, buf_getwriteptr(line, len), &len); 392 base64_encode(keyblob, keybloblen, buf_getwriteptr(line, len), &len);