Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rdma-mwe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Titouan Soulard
rdma-mwe
Commits
4c55895a
Commit
4c55895a
authored
Feb 20, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trx-bridge: avoid buffer overflow
parent
631eafe2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
include/trx-bridge/bridge.h
include/trx-bridge/bridge.h
+5
-0
trx-bridge/bridge.c
trx-bridge/bridge.c
+2
-5
No files found.
include/trx-bridge/bridge.h
View file @
4c55895a
...
...
@@ -5,6 +5,11 @@
#include <unistd.h>
#include "amarisoft/trx_driver.h"
#include "common/circular_buffer.h"
#include "common/hashtable.h"
#include "libpotoml/toml.h"
// Size of TRX buffer in IQ samples (complex)
#define TRX_BUFFER_SIZE 8192
#define SAMPLE_RATE_KHZ 30720
trx-bridge/bridge.c
View file @
4c55895a
#include "trx-bridge/bridge.h"
// Size of TRX buffer in IQ samples (complex)
#define TRX_BUFFER_SIZE 4096
#define SAMPLE_RATE_KHZ 30720
char
*
bridge_trx_input_get_param_string
(
void
*
app_opaque
,
const
char
*
prop_name
)
{
return
potoml_toml_get_string
((
struct
PotomlTomlSubset
*
)
app_opaque
,
prop_name
);
}
...
...
@@ -327,7 +323,8 @@ int main(int argc, char *argv[]) {
if
(
output_read_count
>
0
)
input_trx_state
.
trx_write_func2
(
&
input_trx_state
,
input_tx_ts
,
(
const
void
**
)
output_channels
,
output_read_count
,
0
,
&
write_md
);
// Reading from input decrease the sample count to be read on next iteration
input_read_count
=
input_trx_state
.
trx_read_func2
(
&
input_trx_state
,
&
input_rx_ts
,
(
void
**
)
input_channels
,
input_max_read_count
,
0
,
&
read_md
);
input_read_count
=
MIN
(
TRX_BUFFER_SIZE
,
input_max_read_count
);
input_read_count
=
input_trx_state
.
trx_read_func2
(
&
input_trx_state
,
&
input_rx_ts
,
(
void
**
)
input_channels
,
input_read_count
,
0
,
&
read_md
);
input_max_read_count
-=
input_read_count
;
// Same timestamp handling as for output
...
...
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