Skip to content

Commit 83018cc

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 1242ab5 commit 83018cc

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ jobs:
2121

2222
- name: Download dependencies
2323
run: |
24+
<<<<<<< HEAD
2425
apt update && apt install -y python3-pip git python3-rosdep python3-colcon-common-extensions curl
26+
=======
27+
apt update && apt install -y python3-pip git python3-rosdep python3-colcon-common-extensions curl ros-$ROS_DISTRO-performance-test-fixture gcovr
28+
>>>>>>> aa15666 (Fix max lenght in UDP port string (#315))
2529
git clone -b ros2 https://github.com/eProsima/Micro-CDR src/Micro-CDR
2630
git clone -b ros2 https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client
2731
git clone -b humble https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds
2832
git clone -b humble https://github.com/ros2/rmw src/rmw
2933
touch src/rosidl_typesupport_microxrcedds/test/COLCON_IGNORE
3034
# Install coverage tools
31-
pip3 install gcovr
3235
. /opt/ros/$ROS_DISTRO/setup.sh
3336
rosdep init && rosdep update
3437
rosdep install --from-paths src -r
@@ -45,14 +48,14 @@ jobs:
4548
colcon test --event-handlers console_direct+ --packages-select=rmw_microxrcedds --return-code-on-test-failure
4649
./build/rmw_microxrcedds/test/test-sizes 2> memanalisys_out
4750
48-
- name: Static memory
49-
continue-on-error: true
50-
if: github.event_name == 'pull_request'
51-
uses: machine-learning-apps/pr-comment@master
52-
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
with:
55-
path: memanalisys_out
51+
# - name: Static memory
52+
# continue-on-error: true
53+
# if: github.event_name == 'pull_request'
54+
# uses: machine-learning-apps/pr-comment@master
55+
# env:
56+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
# with:
58+
# path: memanalisys_out
5659

5760
- name: Coverage
5861
run: |

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_graph.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ rmw_ret_t rmw_graph_init(
8484
graph_info->datareader_id = uxr_object_id(context->id_datareader++, UXR_DATAREADER_ID);
8585
const char * graph_topic_name = "ros_to_microros_graph";
8686
graph_info->graph_type_support =
87-
rosidl_typesupport_microxrcedds_c__get_message_type_support_handle__micro_ros_msgs__msg__Graph(); //NOLINT
87+
// NOLINTNEXTLINE
88+
rosidl_typesupport_microxrcedds_c__get_message_type_support_handle__micro_ros_msgs__msg__Graph();
8889

8990
// Create graph topic request
9091
graph_info->topic_id = uxr_object_id(context->id_topic++, UXR_TOPIC_ID);

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)