diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-03 13:10:31 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-03 13:10:31 +0000 |
commit | bcafc11cc0a7f94ac617fd4139fca6b0add83d84 (patch) | |
tree | 3545c7a5e4bbb02e19ae8ed1eb0a710c1ecb09c2 /stream | |
parent | cb9cde3f8c627d26f3104610b3f7a0506344da17 (diff) | |
download | mpv-bcafc11cc0a7f94ac617fd4139fca6b0add83d84.tar.bz2 mpv-bcafc11cc0a7f94ac617fd4139fca6b0add83d84.tar.xz |
replaced 2 instances of sprintf() with snprintf() and one instance
of strncpy() followed by string termination with strlcpy();
patch by njkain gmail com. This patch is intended to render code
easier to audit against buffer oveflows
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22420 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_dvb.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index a7f6aeff2f..154229b2fc 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -176,8 +176,7 @@ static dvb_channels_list *dvb_get_channels(char *filename, int type) ptr->name = (char*) malloc(k+1); if(! ptr->name) continue; - strncpy(ptr->name, line, k); - ptr->name[k] = 0; + strlcpy(ptr->name, line, k+1); } else continue; @@ -764,7 +763,7 @@ dvb_config_t *dvb_get_config(void) conf->cards = NULL; for(i=0; i<MAX_CARDS; i++) { - sprintf(filename, "/dev/dvb/adapter%d/frontend0", i); + snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend0", i); fd = open(filename, O_RDONLY|O_NONBLOCK); if(fd < 0) { @@ -824,7 +823,7 @@ dvb_config_t *dvb_get_config(void) conf->cards[conf->count].devno = i; conf->cards[conf->count].list = list; conf->cards[conf->count].type = type; - sprintf(name, "DVB-%c card n. %d", type==TUNER_TER ? 'T' : (type==TUNER_CBL ? 'C' : 'S'), conf->count+1); + snprintf(name, 20, "DVB-%c card n. %d", type==TUNER_TER ? 'T' : (type==TUNER_CBL ? 'C' : 'S'), conf->count+1); conf->cards[conf->count].name = name; conf->count++; } |