Bugzilla – Attachment 658 Details for
Bug 884
DSA keys (id_dsa.pub) with 8192 bits or more aren't correctly recognized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
changes on the fly the line buffer size in key_try_load_public()
openssh-3.8.1p1.patch (text/plain), 1.63 KB, created by
Alessandro Di Marco
on 2004-06-24 02:42:30 AEST
(
hide
)
Description:
changes on the fly the line buffer size in key_try_load_public()
Filename:
MIME Type:
Creator:
Alessandro Di Marco
Created:
2004-06-24 02:42:30 AEST
Size:
1.63 KB
patch
obsolete
>diff -uNr openssh-3.8.1p1/authfile.c openssh-3.8.1p1-patched/authfile.c >--- openssh-3.8.1p1/authfile.c 2003-09-22 13:01:27.000000000 +0200 >+++ openssh-3.8.1p1-patched/authfile.c 2004-06-23 17:37:59.689319848 +0200 >@@ -588,17 +588,63 @@ > return prv; > } > >+static char * >+read_whole_line(char *line, size_t *size, FILE *f) >+{ >+ long lstart; >+ size_t sz = *size; >+ >+ if (!line) { >+ fatal("read_whole_line: NULL pointer given as line argument"); >+ } >+ >+ lstart = ftell(f); >+ if (!~lstart) { >+ fatal("read_whole_line: cannot read the current stream offset"); >+ } >+ >+ up: >+ line[sz - 2] = '\0'; >+ >+ if (fgets(line, sz, f)) { >+ if (line[sz - 2] != '\0') { >+ sz <<= 1; >+ if (sz <= *size) { >+ fatal("read_whole_line: line buffer overflow"); >+ } >+ >+ line = xrealloc(line, sz); >+ >+ if (!~fseek(f, lstart, SEEK_SET)) { >+ fatal("read_whole_line: cannot rewind to the old stream offset (%ld)", lstart); >+ } >+ >+ goto up; >+ } >+ >+ *size = sz; >+ >+ return line; >+ } >+ >+ return NULL; >+} >+ > static int > key_try_load_public(Key *k, const char *filename, char **commentp) > { > FILE *f; >- char line[4096]; >+ size_t size; >+ char *line; > char *cp; > > f = fopen(filename, "r"); > if (f != NULL) { >- while (fgets(line, sizeof(line), f)) { >- line[sizeof(line)-1] = '\0'; >+ size = 1024; >+ line = xmalloc(size); >+ >+ while (read_whole_line(line, &size, f)) { >+ line[size-1] = '\0'; > cp = line; > switch (*cp) { > case '#': >@@ -613,11 +659,15 @@ > if (key_read(k, &cp) == 1) { > if (commentp) > *commentp=xstrdup(filename); >+ >+ xfree(line); > fclose(f); > return 1; > } > } > } >+ >+ xfree(line); > fclose(f); > } > return 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 884
:
658
|
659
|
660
|
661
|
663
|
733
|
734
|
735