comparison svr-authpubkey.c @ 1455:4afde04f0607 fuzz

merge up to date
author Matt Johnston <matt@ucc.asn.au>
date Tue, 23 Jan 2018 22:46:07 +0800
parents 15d4b821bcc9
children fb90a5ba84e0
comparison
equal deleted inserted replaced
1450:5b25d86b865b 1455:4afde04f0607
194 buffer *options_buf = NULL; 194 buffer *options_buf = NULL;
195 unsigned int pos, len; 195 unsigned int pos, len;
196 int ret = DROPBEAR_FAILURE; 196 int ret = DROPBEAR_FAILURE;
197 197
198 if (line->len < MIN_AUTHKEYS_LINE || line->len > MAX_AUTHKEYS_LINE) { 198 if (line->len < MIN_AUTHKEYS_LINE || line->len > MAX_AUTHKEYS_LINE) {
199 TRACE(("checkpubkey: bad line length %d", line->len)) 199 TRACE(("checkpubkey_line: bad line length %d", line->len))
200 return DROPBEAR_FAILURE; 200 return DROPBEAR_FAILURE;
201 } 201 }
202 202
203 /* compare the algorithm. +3 so we have enough bytes to read a space and some base64 characters too. */ 203 /* compare the algorithm. +3 so we have enough bytes to read a space and some base64 characters too. */
204 if (line->pos + algolen+3 > line->len) { 204 if (line->pos + algolen+3 > line->len) {
259 } 259 }
260 buf_incrpos(line, algolen); 260 buf_incrpos(line, algolen);
261 261
262 /* check for space (' ') character */ 262 /* check for space (' ') character */
263 if (buf_getbyte(line) != ' ') { 263 if (buf_getbyte(line) != ' ') {
264 TRACE(("checkpubkey: space character expected, isn't there")) 264 TRACE(("checkpubkey_line: space character expected, isn't there"))
265 goto out; 265 goto out;
266 } 266 }
267 267
268 /* truncate the line at the space after the base64 data */ 268 /* truncate the line at the space after the base64 data */
269 pos = line->pos; 269 pos = line->pos;
271 if (buf_getbyte(line) == ' ') break; 271 if (buf_getbyte(line) == ' ') break;
272 } 272 }
273 buf_setpos(line, pos); 273 buf_setpos(line, pos);
274 buf_setlen(line, line->pos + len); 274 buf_setlen(line, line->pos + len);
275 275
276 TRACE(("checkpubkey: line pos = %d len = %d", line->pos, line->len)) 276 TRACE(("checkpubkey_line: line pos = %d len = %d", line->pos, line->len))
277 277
278 ret = cmp_base64_key(keyblob, keybloblen, (const unsigned char *) algo, algolen, line, NULL); 278 ret = cmp_base64_key(keyblob, keybloblen, (const unsigned char *) algo, algolen, line, NULL);
279 279
280 if (ret == DROPBEAR_SUCCESS && options_buf) { 280 if (ret == DROPBEAR_SUCCESS && options_buf) {
281 ret = svr_add_pubkey_options(options_buf, line_num, filename); 281 ret = svr_add_pubkey_options(options_buf, line_num, filename);
359 TRACE(("checkpubkey: authorized_keys EOF reached")) 359 TRACE(("checkpubkey: authorized_keys EOF reached"))
360 break; 360 break;
361 } 361 }
362 line_num++; 362 line_num++;
363 363
364 if (checkpubkey_line(line, line_num, filename, 364 ret = checkpubkey_line(line, line_num, filename, algo, algolen, keyblob, keybloblen);
365 algo, algolen, keyblob, keybloblen) == DROPBEAR_SUCCESS) { 365 if (ret == DROPBEAR_SUCCESS) {
366 break; 366 break;
367 } 367 }
368 368
369 /* We continue to the next line otherwise */ 369 /* We continue to the next line otherwise */
370 370