blob: 797c9a8b55c3ba54cfe7237ed53d903859acaba6 (
plain)
#######################################################################
# Fixes index listings with only LF and no CRs.
# dave@slackbuilds.org
#######################################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2020-01-08 07:39:33.403725857 +0000
+++ b/src/protocol/gopher/gopher.c 2020-01-08 07:40:30.587406965 +0000
@@ -779,6 +779,15 @@
switch (gopher->entity->type) {
case GOPHER_DIRECTORY:
case GOPHER_INDEX:
+ /* Lines with no carriage returns */
+ if (strchr(rb->data, ASCII_CR) == NULL) {
+ unsigned char *tmp = malloc(rb->length + 3);
+ tmp[0] = 'i';
+ tmp = stpcpy(stpcpy(stpcpy(tmp, rb->data), '\r'), '\n');
+ rb->length += 3;
+ memcpy(rb->data, tmp, rb->length);
+ free(tmp);
+ }
state = read_gopher_directory_data(conn, rb);
break;
|