diff options
| author | Anton <anton@picapica.im> | 2026-11-11 05:05:40 +0400 |
|---|---|---|
| committer | Anton <anton@picapica.im> | 2026-11-11 05:05:40 +0400 |
| commit | 250700b4c51fa8967385b45192541c50c06e9bd8 (patch) | |
| tree | 1eb970951ea28dbca02bf45903d23a78bbef61f0 | |
| parent | 87129ab59f9a8b5a9cf349592ada18b7da1921ad (diff) | |
| download | pica-pica-250700b4c51fa8967385b45192541c50c06e9bd8.tar.gz pica-pica-250700b4c51fa8967385b45192541c50c06e9bd8.zip | |
pica-client: harden DIRECTC2C_SWITCH processing
| -rw-r--r-- | PICA_client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/PICA_client.c b/PICA_client.c index 8f80b5a..51ae6a1 100644 --- a/PICA_client.c +++ b/PICA_client.c @@ -759,6 +759,13 @@ unsigned int procmsg_PICA_PROTO_DIRECTC2C_SWITCH(unsigned char* buf, unsigned in if (cc->directc2c_state != PICA_DIRECTC2C_STATE_ACTIVE && cc->directc2c_state != PICA_DIRECTC2C_STATE_CONNECTING) return 0; + /* A SWITCH may legitimately arrive while our own direct link is still + * CONNECTING, but switching reads to it before its SSL object exists + * would hand SSL_read() a NULL. Refuse until the direct session is there. + */ + if (!cc->direct || !cc->direct->ssl) + return 0; + cc->switched_to_directc2c_read = 1; return 1; |
