From 17f9626b5dd86085a155922221f41338bc8bba1f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 9 Sep 2012 14:41:18 +0200 Subject: tiff/doubles2str: check for truncation Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavcodec/tiff.c') diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index b0ffd7bf61..078c29a541 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -215,7 +215,9 @@ static char *doubles2str(double *dp, int count, const char *sep) ap0 = ap; ap[0] = '\0'; for (i = 0; i < count; i++) { - int l = snprintf(ap, component_len, "%f%s", dp[i], sep); + unsigned l = snprintf(ap, component_len, "%f%s", dp[i], sep); + if(l >= component_len) + return NULL; ap += l; } ap0[strlen(ap0) - strlen(sep)] = '\0'; -- cgit v1.2.3