Skip to content

Commit

Permalink
fix crash when plain text is served as type 1
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed May 2, 2023
1 parent 7251bc2 commit 646bfc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gopher.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ static void parse_gophermap_line(char *line, int *pre, Selector **sel, SelectorL
*sel = new_selector(*line == 'i' ? '`' : 'l');
(*sel)-> prompt = *line == '7';

path = line + 1 + strcspn(line + 1, "\t");
if (*(path = line + 1 + strcspn(line + 1, "\t")) == '\0') goto fail;
*path = '\0';
++path;
host = path + strcspn(path, "\t");
if (*(host = path + strcspn(path, "\t")) == '\0') goto fail;
*host = '\0';
++host;
if ((port = host + strcspn(host, "\t")) == host) goto fail;
if (*(port = host + strcspn(host, "\t")) == '\0') goto fail;
*port = '\0';
++port;
*(port + strcspn(port, "\t")) = '\0';
Expand Down

0 comments on commit 646bfc0

Please sign in to comment.