4747 * Returns the new write position. If there is not enough room, the buffer
4848 * is left untouched and the original _len is returned. */
4949static size_t safe_strbuf_append (char * s , size_t len , size_t _len ,
50- const char * suffix )
50+ const char * suffix , size_t suffix_len )
5151{
52- size_t suffix_len = strlen (suffix );
5352 if (_len + suffix_len < len )
5453 {
5554 memcpy (s + _len , suffix , suffix_len );
@@ -89,7 +88,7 @@ static void sanitize_to_string(char *s, const char *lbl, size_t len)
8988 _len = strlcpy(s, title, len); \
9089 if (!string_is_empty(path)) \
9190 { \
92- _len = safe_strbuf_append(s, len, _len, ": "); \
91+ _len = safe_strbuf_append(s, len, _len, ": ", STRLEN_CONST(": ") ); \
9392 strlcpy(s + _len, path, len - _len); \
9493 } \
9594 return 1; \
@@ -126,7 +125,7 @@ static void action_get_title_fill_path_search_filter_default(
126125 const char * title = msg_hash_to_str (lbl );
127126 if (!string_is_empty (title ))
128127 _len = strlcpy (s , title , len );
129- _len = safe_strbuf_append (s , len , _len , " " );
128+ _len = safe_strbuf_append (s , len , _len , " " , STRLEN_CONST ( " " ) );
130129 if (!string_is_empty (path ))
131130 strlcpy (s + _len , path , len - _len );
132131
@@ -445,7 +444,7 @@ static int action_get_title_deferred_core_backup_list(
445444 return 0 ;
446445
447446 _len = strlcpy (s , prefix , len );
448- _len = safe_strbuf_append (s , len , _len , ": " );
447+ _len = safe_strbuf_append (s , len , _len , ": " , STRLEN_CONST ( ": " ) );
449448
450449 /* Search for specified core
451450 * > If core is found, add display name */
@@ -522,7 +521,7 @@ static int action_get_core_information_steam_list(
522521 char * s , size_t len )
523522{
524523 size_t _len = strlcpy (s , msg_hash_to_str (MENU_ENUM_LABEL_VALUE_CORE_INFORMATION ), len );
525- _len = safe_strbuf_append (s , len , _len , " - " );
524+ _len = safe_strbuf_append (s , len , _len , " - " , STRLEN_CONST ( " - " ) );
526525 strlcpy (s + _len , path , len - _len );
527526 return 1 ;
528527}
@@ -839,7 +838,7 @@ static int action_get_sideload_core_list(const char *path, const char *label,
839838 unsigned menu_type , char * s , size_t len )
840839{
841840 size_t _len = strlcpy (s , msg_hash_to_str (MENU_ENUM_LABEL_VALUE_SIDELOAD_CORE_LIST ), len );
842- _len = safe_strbuf_append (s , len , _len , " " );
841+ _len = safe_strbuf_append (s , len , _len , " " , STRLEN_CONST ( " " ) );
843842 if (!string_is_empty (path ))
844843 strlcpy (s + _len , path , len - _len );
845844 return 0 ;
@@ -852,7 +851,7 @@ static int action_get_title_default(const char *path, const char *label,
852851 msg_hash_to_str (MENU_ENUM_LABEL_VALUE_SELECT_FILE ), len );
853852 if (!string_is_empty (path ))
854853 {
855- _len = safe_strbuf_append (s , len , _len , ": " );
854+ _len = safe_strbuf_append (s , len , _len , ": " , STRLEN_CONST ( ": " ) );
856855#if IOS
857856 fill_pathname_abbreviate_special (s + _len , path , len - _len );
858857#else
@@ -923,7 +922,7 @@ static int action_get_title_group_settings(const char *path, const char *label,
923922 _len = first_len ;
924923 if (sep [1 ] != '\0' )
925924 {
926- _len = safe_strbuf_append (s , len , _len , " - " );
925+ _len = safe_strbuf_append (s , len , _len , " - " , STRLEN_CONST ( " - " ) );
927926 strlcpy (s + _len , sep + 1 , len - _len );
928927 }
929928 }
0 commit comments