Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Synchronet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
140
Issues
140
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main
Synchronet
Commits
bfc0ecac
Commit
bfc0ecac
authored
Nov 21, 2020
by
Deon George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change read_socket_line() to fail if we dont get a NULL or \n terminated string within buflen.
parent
598ad56b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
src/xpdev/multisock.c
src/xpdev/multisock.c
+8
-5
No files found.
src/xpdev/multisock.c
View file @
bfc0ecac
...
...
@@ -301,7 +301,7 @@ static BOOL read_socket_line(SOCKET sock, char *buffer, size_t buflen, int (*lpr
if
(
read_socket
(
sock
,
&
buffer
[
i
],
1
,
lprintf
))
{
switch
(
buffer
[
i
])
{
case
0
:
return
(
strlen
(
buffer
)
>
0
)
;
return
TRUE
;
case
'\n'
:
buffer
[
i
+
1
]
=
'\0'
;
return
TRUE
;
...
...
@@ -309,12 +309,12 @@ static BOOL read_socket_line(SOCKET sock, char *buffer, size_t buflen, int (*lpr
}
else
{
buffer
[
i
]
=
0
;
return
(
strlen
(
buffer
)
>
0
)
;
return
FALSE
;
}
}
buffer
[
i
]
=
0
;
return
TRU
E
;
return
FALS
E
;
}
SOCKET
DLLCALL
xpms_accept
(
struct
xpms_set
*
xpms_set
,
union
xp_sockaddr
*
addr
,
...
...
@@ -371,9 +371,12 @@ SOCKET DLLCALL xpms_accept(struct xpms_set *xpms_set, union xp_sockaddr * addr,
xpms_set
->
lprintf
(
LOG_DEBUG
,
"%04d Working out client address from HAProxy PROTO"
,
ret
);
// Read the first line
// In normal proxy usage, we shouldnt fail here - but if there is a badly implemented HAPROXY PROTO
// or the user attempts to connect direct to the BBS (not via the proxy) there could be anything
// received (IAC sequences, SSH setup, or just badness)
if
(
!
read_socket_line
(
ret
,
hapstr
,
108
,
xpms_set
->
lprintf
))
{
btox
(
haphex
,
hapstr
,
108
,
sizeof
(
haphex
),
xpms_set
->
lprintf
);
xpms_set
->
lprintf
(
LOG_ERR
,
"%04d * HAPROXY looking for version - failed [%s]"
,
ret
,
hap
str
);
btox
(
haphex
,
hapstr
,
strlen
(
hapstr
)
,
sizeof
(
haphex
),
xpms_set
->
lprintf
);
xpms_set
->
lprintf
(
LOG_ERR
,
"%04d * HAPROXY looking for version - failed [%s]"
,
ret
,
hap
hex
);
closesocket
(
ret
);
return
INVALID_SOCKET
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment