Mercurial > mplayer.hg
changeset 14256:27002dcf0a70
ensure af_fmt2str always return a 0 terminated string
author | reimar |
---|---|
date | Mon, 27 Dec 2004 19:47:33 +0000 |
parents | 137896e25c24 |
children | a99ccb34a59c |
files | libaf/af_format.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af_format.c Mon Dec 27 19:43:13 2004 +0000 +++ b/libaf/af_format.c Mon Dec 27 19:47:33 2004 +0000 @@ -110,6 +110,10 @@ { int i=0; + if (size < 1) + return NULL; + size--; // reserve one for terminating 0 + // Endianess if(AF_FORMAT_LE == (format & AF_FORMAT_END_MASK)) i+=snprintf(str,size-i,"little endian "); @@ -147,6 +151,7 @@ i+=snprintf(&str[i],size-i,"int "); } } + str[i] = 0; // make sure it is 0 terminated. return str; }