3333
3434#include <libretro.h>
3535#include <clamping.h>
36+ #include <compat/strl.h>
3637#include <retro_miscellaneous.h>
3738
3839#include <sys/mman.h>
@@ -607,9 +608,9 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_get_system_av_info)(struct retro_syst
607608 info -> geometry .base_height = video_format .fmt .pix .height ;
608609
609610 if (capture_resolution .value != NULL )
610- strncpy (video_capture_resolution , capture_resolution .value , ENVVAR_BUFLEN - 1 );
611+ strlcpy (video_capture_resolution , capture_resolution .value , sizeof ( video_capture_resolution ) );
611612 else
612- strncpy (video_capture_resolution , "auto" , ENVVAR_BUFLEN - 1 );
613+ strlcpy (video_capture_resolution , "auto" , sizeof ( video_capture_resolution ) );
613614
614615 if (strcmp (video_capture_resolution , "auto" ) != 0 )
615616 {
@@ -1047,7 +1048,7 @@ RETRO_API void VIDEOPROC_CORE_PREFIX(retro_run)(void)
10471048 }
10481049
10491050 if (frametimes .value != NULL )
1050- strncpy (video_frame_times , frametimes .value , ENVVAR_BUFLEN - 1 );
1051+ strlcpy (video_frame_times , frametimes .value , sizeof ( video_frame_times ) );
10511052 }
10521053
10531054 VIDEOPROC_CORE_PREFIX (input_poll_cb )();
@@ -1217,18 +1218,18 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
12171218 close_devices ();
12181219 return false;
12191220 }
1220- strncpy (video_device , videodev .value , ENVVAR_BUFLEN - 1 );
1221+ strlcpy (video_device , videodev .value , sizeof ( video_device ) );
12211222
12221223 /* Audio device is optional... */
12231224 VIDEOPROC_CORE_PREFIX (environment_cb )(RETRO_ENVIRONMENT_GET_VARIABLE , & audiodev );
12241225 if (audiodev .value != NULL )
1225- strncpy (audio_device , audiodev .value , ENVVAR_BUFLEN - 1 );
1226+ strlcpy (audio_device , audiodev .value , sizeof ( audio_device ) );
12261227
12271228 VIDEOPROC_CORE_PREFIX (environment_cb )(RETRO_ENVIRONMENT_GET_VARIABLE , & capture_resolution );
12281229 if (capture_resolution .value != NULL )
1229- strncpy (video_capture_resolution , capture_resolution .value , ENVVAR_BUFLEN - 1 );
1230+ strlcpy (video_capture_resolution , capture_resolution .value , sizeof ( video_capture_resolution ) );
12301231 else
1231- strncpy (video_capture_resolution , "auto" , ENVVAR_BUFLEN - 1 );
1232+ strlcpy (video_capture_resolution , "auto" , sizeof ( video_capture_resolution ) );
12321233
12331234 VIDEOPROC_CORE_PREFIX (environment_cb )(RETRO_ENVIRONMENT_GET_VARIABLE , & capture_mode );
12341235 VIDEOPROC_CORE_PREFIX (environment_cb )(RETRO_ENVIRONMENT_GET_VARIABLE , & output_mode );
@@ -1237,12 +1238,12 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
12371238 close_devices ();
12381239 return false;
12391240 }
1240- strncpy (video_capture_mode , capture_mode .value , ENVVAR_BUFLEN - 1 );
1241- strncpy (video_output_mode , output_mode .value , ENVVAR_BUFLEN - 1 );
1241+ strlcpy (video_capture_mode , capture_mode .value , sizeof ( video_capture_mode ) );
1242+ strlcpy (video_output_mode , output_mode .value , sizeof ( video_output_mode ) );
12421243
12431244 VIDEOPROC_CORE_PREFIX (environment_cb )(RETRO_ENVIRONMENT_GET_VARIABLE , & frame_times );
12441245 if (frame_times .value != NULL )
1245- strncpy (video_frame_times , frame_times .value , ENVVAR_BUFLEN - 1 );
1246+ strlcpy (video_frame_times , frame_times .value , sizeof ( video_frame_times ) );
12461247
12471248 if (strcmp (video_device , "dummy" ) == 0 )
12481249 {
@@ -1499,8 +1500,8 @@ RETRO_API bool VIDEOPROC_CORE_PREFIX(retro_load_game)(const struct retro_game_in
14991500
15001501RETRO_API void VIDEOPROC_CORE_PREFIX (retro_unload_game )(void )
15011502{
1502- struct v4l2_requestbuffers reqbufs ;
15031503 int i ;
1504+ struct v4l2_requestbuffers reqbufs ;
15041505
15051506#ifdef HAVE_ALSA
15061507 if (audio_handle != NULL )
0 commit comments