diff options
-rw-r--r-- | sesman/libscp/libscp_v0.c | 9 | ||||
-rw-r--r-- | sesman/libscp/libscp_v1s.c | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/sesman/libscp/libscp_v0.c b/sesman/libscp/libscp_v0.c index 8cf1340b..7fbdd2e8 100644 --- a/sesman/libscp/libscp_v0.c +++ b/sesman/libscp/libscp_v0.c @@ -252,7 +252,14 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk) scp_session_set_height(session, sz); /* bpp */ in_uint16_be(c->in_s, sz); - scp_session_set_bpp(session, (tui8)sz); + if (0 != scp_session_set_bpp(session, (tui8)sz)) + { + scp_session_destroy(session); + log_message(LOG_LEVEL_WARNING, + "[v0:%d] connection aborted: unsupported bpp: %d", + __LINE__, (tui8)sz); + return SCP_SERVER_STATE_INTERNAL_ERR; + } if (s_check_rem(c->in_s, 2)) { diff --git a/sesman/libscp/libscp_v1s.c b/sesman/libscp/libscp_v1s.c index fb137433..ac370ad9 100644 --- a/sesman/libscp/libscp_v1s.c +++ b/sesman/libscp/libscp_v1s.c @@ -131,6 +131,14 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES in_uint16_be(c->in_s, cmd); scp_session_set_height(session, cmd); in_uint8(c->in_s, sz); + if (0 != scp_session_set_bpp(session, sz)) + { + scp_session_destroy(session); + log_message(LOG_LEVEL_WARNING, + "[v1s:%d] connection aborted: unsupported bpp: %d", + __LINE__, sz); + return SCP_SERVER_STATE_INTERNAL_ERR; + } scp_session_set_bpp(session, sz); in_uint8(c->in_s, sz); scp_session_set_rsr(session, sz); |