summaryrefslogtreecommitdiffstats
path: root/sesman/libscp
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2016-02-10 01:14:40 -0800
committerPavel Roskin <plroskin@gmail.com>2016-02-10 09:30:23 -0800
commit5d23d007e9ec0dbc5a43d3bc66326574b6df1e0e (patch)
treeaa38753d47e3451cb18c444094a1e8c7f1d41f34 /sesman/libscp
parent7e20d421cc46132d66ea66d5793e4e2af8fba6c0 (diff)
downloadxrdp-proprietary-5d23d007e9ec0dbc5a43d3bc66326574b6df1e0e.tar.gz
xrdp-proprietary-5d23d007e9ec0dbc5a43d3bc66326574b6df1e0e.zip
Check return value of scp_session_set_bpp()
Diffstat (limited to 'sesman/libscp')
-rw-r--r--sesman/libscp/libscp_v0.c9
-rw-r--r--sesman/libscp/libscp_v1s.c8
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);