Skip to content

Commit b7b0997

Browse files
pablogs9mergify[bot]
authored andcommitted
Fix max lenght in UDP port string (#315)
* Fix max lenght in UDP port string * Fix CI Signed-off-by: Pablo Garrido <pablogs9@gmail.com> * Update * Linting * Update * Fix uncrustify --------- Signed-off-by: Pablo Garrido <pablogs9@gmail.com> (cherry picked from commit aa15666) # Conflicts: # .github/workflows/ci.yml
1 parent 554445f commit b7b0997

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ jobs:
2323

2424
- name: Download dependencies
2525
run: |
26-
apt update && apt install -y python3-pip git python3-rosdep python3-colcon-common-extensions curl ros-$ROS_DISTRO-performance-test-fixture
26+
apt update && apt install -y python3-pip git python3-rosdep python3-colcon-common-extensions curl ros-$ROS_DISTRO-performance-test-fixture gcovr
2727
git clone -b ros2 https://github.com/eProsima/Micro-CDR src/Micro-CDR
2828
git clone -b ros2 https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client
2929
git clone -b jazzy https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds
3030
git clone -b jazzy https://github.com/ros2/rmw src/rmw
3131
touch src/rosidl_typesupport_microxrcedds/test/COLCON_IGNORE
3232
3333
# Install coverage tools
34+
<<<<<<< HEAD
3435
apt install -y gcovr
36+
=======
37+
>>>>>>> aa15666 (Fix max lenght in UDP port string (#315))
3538
. /opt/ros/$ROS_DISTRO/setup.sh
3639
rosdep init && rosdep update
3740
rosdep install --from-paths src -r
@@ -47,6 +50,18 @@ jobs:
4750
colcon test --event-handlers console_direct+ --packages-select=rmw_microxrcedds --return-code-on-test-failure
4851
./build/rmw_microxrcedds/test/test-sizes 2> memanalisys_out
4952
53+
<<<<<<< HEAD
54+
=======
55+
# - name: Static memory
56+
# continue-on-error: true
57+
# if: github.event_name == 'pull_request'
58+
# uses: machine-learning-apps/pr-comment@master
59+
# env:
60+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
# with:
62+
# path: memanalisys_out
63+
64+
>>>>>>> aa15666 (Fix max lenght in UDP port string (#315))
5065
- name: Coverage
5166
run: |
5267
cd src/rmw-microxrcedds/

rmw_microxrcedds_c/include/rmw_microros/rmw_microros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern "C"
4949
#elif defined(RMW_UXRCE_TRANSPORT_IPV6)
5050
#define MAX_IP_LEN 39
5151
#endif // ifdef RMW_UXRCE_TRANSPORT_IPV4
52-
#define MAX_PORT_LEN 5
52+
#define MAX_PORT_LEN 6 // uint16_t max size + NULL-end string
5353
#define MAX_SERIAL_DEVICE 50
5454

5555
typedef struct rmw_uxrce_transport_params_t

rmw_microxrcedds_c/src/rmw_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ rmw_init_options_init(
9292
return RMW_RET_INVALID_ARGUMENT;
9393
}
9494

95-
if (strlen(RMW_UXRCE_DEFAULT_PORT) <= MAX_PORT_LEN) {
95+
if (strlen(RMW_UXRCE_DEFAULT_PORT) < MAX_PORT_LEN) {
9696
snprintf(
9797
init_options->impl->transport_params.agent_port,
9898
MAX_PORT_LEN, "%s", RMW_UXRCE_DEFAULT_PORT);

rmw_microxrcedds_c/src/rmw_microros/init_options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ rmw_ret_t rmw_uros_options_set_udp_address(
9797
return RMW_RET_INVALID_ARGUMENT;
9898
}
9999

100-
if (port != NULL && strlen(port) <= MAX_PORT_LEN) {
100+
if (port != NULL && strlen(port) < MAX_PORT_LEN) {
101101
snprintf(rmw_options->impl->transport_params.agent_port, MAX_PORT_LEN, "%s", port);
102102
} else {
103103
RMW_UROS_TRACE_MESSAGE("default port configuration error")

0 commit comments

Comments
 (0)