Re-allow line-feeds in META when in strict mode

This commit is contained in:
styan 2020-05-05 11:36:20 +00:00
parent d03242fd28
commit 52a7ddb92c
1 changed files with 8 additions and 3 deletions

View File

@ -337,10 +337,15 @@ gemini_read(struct gemini *g, void *b, size_t bs)
break;
}
if (g->metalen > 0 &&
g->meta[g->metalen - 1] == '\r')
g->meta[g->metalen - 1] == '\r') {
g->metalen--;
else if (g->flags & GEMINI_STRICT)
goto errinval;
} else if (g->flags & GEMINI_STRICT) {
if (g->metalen == GEMINI_META_MAX)
goto errinval;
g->meta[g->metalen++] = '\n';
i = j + 1;
break;
}
if (g->metalen > GEMINI_META_MAX)
goto errinval;
g->meta[g->metalen] = '\0';