mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-18 03:28:07 -05:00
Oops; telnet:// URLs can have a trailing slash
[originally from svn r515]
This commit is contained in:
parent
777e064ed5
commit
1657255cd7
10
window.c
10
window.c
@ -179,14 +179,18 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
|
|||||||
* Telnet URL.
|
* Telnet URL.
|
||||||
*/
|
*/
|
||||||
if (!strncmp(q, "telnet://", 9)) {
|
if (!strncmp(q, "telnet://", 9)) {
|
||||||
|
char c;
|
||||||
|
|
||||||
q += 9;
|
q += 9;
|
||||||
cfg.protocol = PROT_TELNET;
|
cfg.protocol = PROT_TELNET;
|
||||||
p = q;
|
p = q;
|
||||||
while (*p && *p != ':') p++;
|
while (*p && *p != ':' && *p != '/') p++;
|
||||||
if (*p) {
|
c = *p;
|
||||||
|
if (*p)
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
|
if (c == ':')
|
||||||
cfg.port = atoi(p);
|
cfg.port = atoi(p);
|
||||||
} else
|
else
|
||||||
cfg.port = -1;
|
cfg.port = -1;
|
||||||
strncpy (cfg.host, q, sizeof(cfg.host)-1);
|
strncpy (cfg.host, q, sizeof(cfg.host)-1);
|
||||||
cfg.host[sizeof(cfg.host)-1] = '\0';
|
cfg.host[sizeof(cfg.host)-1] = '\0';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user