From 1f3f9507997830c8fc229e53dadca3ef6eb8149f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Jan 2005 01:44:02 +0000 Subject: [PATCH] disallow strcat Originally committed as revision 3826 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/common.h | 1 + vhook/ppm.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/common.h b/libavcodec/common.h index c33812e697..ec81297ba2 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -500,6 +500,7 @@ tend= rdtsc();\ #define rand rand_is_forbidden_due_to_state_trashing #define srand srand_is_forbidden_due_to_state_trashing #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf +#define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H)) #define printf please_use_av_log #define fprintf please_use_av_log diff --git a/vhook/ppm.c b/vhook/ppm.c index 022f6a106b..8e48dd9574 100644 --- a/vhook/ppm.c +++ b/vhook/ppm.c @@ -55,14 +55,15 @@ rwpipe *rwpipe_open( int argc, char *argv[] ) if ( this->pid == 0 ) { - char *command = av_mallocz( 10240 ); +#define COMMAND_SIZE 10240 + char *command = av_mallocz( COMMAND_SIZE ); int i; strcpy( command, "" ); for ( i = 0; i < argc; i ++ ) { - strcat( command, argv[ i ] ); - strcat( command, " " ); + pstrcat( command, COMMAND_SIZE, argv[ i ] ); + pstrcat( command, COMMAND_SIZE, " " ); } dup2( output[ 0 ], STDIN_FILENO );