commit e7ce6d724c1094db17e8241c83e50c77e5b4629f
parent ae35eccea287974e2e157c0b5d2109463ae63db8
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 15 Oct 2017 21:02:45 +0200
extra-carefully check return value of snprintf
Diffstat:
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/plugins/ole2_extractor.c b/src/plugins/ole2_extractor.c
@@ -586,13 +586,16 @@ history_extract (GsfInput *stream,
bsize = strlen (author) + strlen (filename) + 512;
if (NULL != (rbuf = malloc (bsize)))
{
- if (bsize >
- snprintf (rbuf,
- bsize,
- _("Revision #%u: Author `%s' worked on `%s'"),
- i,
- author,
- filename))
+ int snret;
+
+ snret = snprintf (rbuf,
+ bsize,
+ _("Revision #%u: Author `%s' worked on `%s'"),
+ i,
+ author,
+ filename);
+ if ( (-1 != snret) &&
+ (bsize > (size_t) snret) )
{
ret = add_metadata (proc,
proc_cls,