Commit 6d0ff11d authored by JP Dinger's avatar JP Dinger

A few sprintf()+n in text/strings.c

parent 745dbe97
...@@ -792,14 +792,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string ) ...@@ -792,14 +792,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
if( p_item ) if( p_item )
{ {
mtime_t i_duration = input_item_GetDuration( p_item ); mtime_t i_duration = input_item_GetDuration( p_item );
sprintf( buf, "%02d:%02d:%02d", snprintf( buf, 10, "%02d:%02d:%02d",
(int)(i_duration/(3600000000)), (int)(i_duration/(3600000000)),
(int)((i_duration/(60000000))%60), (int)((i_duration/(60000000))%60),
(int)((i_duration/1000000)%60) ); (int)((i_duration/1000000)%60) );
} }
else else
{ {
sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
} }
INSERT_STRING_NO_FREE( buf ); INSERT_STRING_NO_FREE( buf );
break; break;
...@@ -826,14 +826,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string ) ...@@ -826,14 +826,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
{ {
mtime_t i_duration = input_item_GetDuration( p_item ); mtime_t i_duration = input_item_GetDuration( p_item );
int64_t i_time = var_GetInteger( p_input, "time" ); int64_t i_time = var_GetInteger( p_input, "time" );
sprintf( buf, "%02d:%02d:%02d", snprintf( buf, 10, "%02d:%02d:%02d",
(int)( ( i_duration - i_time ) / 3600000000 ), (int)( ( i_duration - i_time ) / 3600000000 ),
(int)( ( ( i_duration - i_time ) / 60000000 ) % 60 ), (int)( ( ( i_duration - i_time ) / 60000000 ) % 60 ),
(int)( ( ( i_duration - i_time ) / 1000000 ) % 60 ) ); (int)( ( ( i_duration - i_time ) / 1000000 ) % 60 ) );
} }
else else
{ {
sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
} }
INSERT_STRING_NO_FREE( buf ); INSERT_STRING_NO_FREE( buf );
break; break;
...@@ -862,7 +862,7 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string ) ...@@ -862,7 +862,7 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
} }
else else
{ {
sprintf( buf, b_empty_if_na ? "" : "--.-%%" ); snprintf( buf, 10, b_empty_if_na ? "" : "--.-%%" );
} }
INSERT_STRING_NO_FREE( buf ); INSERT_STRING_NO_FREE( buf );
break; break;
...@@ -894,14 +894,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string ) ...@@ -894,14 +894,14 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
if( p_input ) if( p_input )
{ {
int64_t i_time = var_GetInteger( p_input, "time" ); int64_t i_time = var_GetInteger( p_input, "time" );
sprintf( buf, "%02d:%02d:%02d", snprintf( buf, 10, "%02d:%02d:%02d",
(int)( i_time / ( 3600000000 ) ), (int)( i_time / ( 3600000000 ) ),
(int)( ( i_time / ( 60000000 ) ) % 60 ), (int)( ( i_time / ( 60000000 ) ) % 60 ),
(int)( ( i_time / 1000000 ) % 60 ) ); (int)( ( i_time / 1000000 ) % 60 ) );
} }
else else
{ {
sprintf( buf, b_empty_if_na ? "" : "--:--:--" ); snprintf( buf, 10, b_empty_if_na ? "" : "--:--:--" );
} }
INSERT_STRING_NO_FREE( buf ); INSERT_STRING_NO_FREE( buf );
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment