Skip to content

Commit

Permalink
Merge pull request #2420 from andrew-platt/b/map_strncpy_2
Browse files Browse the repository at this point in the history
MAP: change strncpy to use macro MAP_STRNCPY
  • Loading branch information
andrew-platt authored Sep 13, 2024
2 parents e8d0ea9 + 4e69da8 commit f59b46e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/map/src/mapapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ MAP_EXTERNCALL void map_set_gravity(MAP_ParameterType_t* p_type, const double gr

MAP_EXTERNCALL void map_set_input_text(MAP_InitInputType_t* init_type, const char* input_txt_line)
{
strncpy(init_type->library_input_str, input_txt_line, 254);
MAP_STRNCPY(init_type->library_input_str, input_txt_line, 254);
init_type->library_input_str[254] = '\0';
}

Expand Down
2 changes: 2 additions & 0 deletions modules/map/src/mapsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@
# define map_snprintf _snprintf
# define map_strcat(a,b,c) strcat_s(a,b,c)
# define MAP_STRCPY(a,b,c) strcpy_s(a,b,c)
# define MAP_STRNCPY(a,b,c) strncpy_s(a,c,b,c)
#else
# include <stdbool.h>
# define map_snprintf snprintf
# define map_strcat(a,b,c) strncat(a,c,b)
# define MAP_STRCPY(a,b,c) strcpy(a,c)
# define MAP_STRNCPY(a,b,c) strncpy(a,b,c)
#endif


Expand Down

0 comments on commit f59b46e

Please sign in to comment.