[Bug 1157] ssh-keygen doesn't handle DOS line breaks
bugzilla-daemon at mindrot.org
bugzilla-daemon at mindrot.org
Mon Feb 27 22:29:06 EST 2006
http://bugzilla.mindrot.org/show_bug.cgi?id=1157
------- Comment #16 from djm at mindrot.org 2006-02-27 22:29 -------
(From update of attachment 1086)
Looks good, a couple of nits:
>+static int
>+get_line(FILE *fp, char *line, size_t len)
>+{
>+ int c;
>+ size_t pos = 0;
>+
>+ if (len > INT_MAX)
>+ return -1;
I don't think this is necessary in the context.
>+ line[pos++] = c;
>+ line[pos] = '\0';
>+ }
>+ return 0;
Maybe this function should return the length of the string, that would save the
strlen() later:
>+ while (get_line(fp, line, sizeof(line)) == 0) {
>+ len = strlen(line);
>+ if (line[len - 1] == '\\')
> escaped++;
Regress test? :)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the openssh-bugs
mailing list