diff options
| author | Dave Hibberd <hibby@debian.org> | 2024-11-12 21:20:03 +0000 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2024-11-12 21:20:03 +0000 |
| commit | 4d14474d923db3022b3074f5a5c4fb7a89ba081c (patch) | |
| tree | adfed2cd661ac45b9a91bd8345f786167fb4158d /AGWAPI.c | |
| parent | 1b40c8c7b54e015f92b7fce1137a1f9c0bbed061 (diff) | |
| parent | 7d1deaae3884a9ca8bdba9df5c7b317171ab3b40 (diff) | |
Update upstream source from tag 'upstream/6.0.24.50'
Update to upstream version '6.0.24.50'
with Debian dir 3f4098912b60dfa9efe9055ce3f628a93c095c82
Diffstat (limited to 'AGWAPI.c')
| -rw-r--r-- | AGWAPI.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -36,14 +36,14 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses struct AGWHeader
{
- int Port;
+ unsigned int Port;
unsigned char DataKind;
unsigned char filler2;
unsigned char PID;
unsigned char filler3;
unsigned char callfrom[10];
unsigned char callto[10];
- int DataLength;
+ unsigned int DataLength;
int reserved;
};
@@ -1063,6 +1063,8 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock) {
if (DataLength > 35)// A header
{
+ struct AGWHeader * AGW = &sockptr->AGWRXHeader;
+
i=recv(sock,(char *)&sockptr->AGWRXHeader, 36, 0);
if (i == SOCKET_ERROR)
@@ -1075,6 +1077,16 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock) sockptr->MsgDataLength = sockptr->AGWRXHeader.DataLength;
+ // Validate packet to protect against accidental (or malicious!) connects from a non-agw application
+
+
+ if (AGW->Port > 64 || AGW->filler2 != 0 || AGW->filler3 != 0 || AGW->DataLength > 400)
+ {
+ Debugprintf("Corrupt AGW Packet Received");
+ AGWDataSocket_Disconnect(sockptr);
+ return 0;
+ }
+
if (sockptr->MsgDataLength > 500)
OutputDebugString("Corrupt AGW message");
|
