diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-07-31 07:09:54 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-07-31 07:09:54 +0000 |
commit | 14ac1a5b413c96f4fcaf434ebfd28d620448e01b (patch) | |
tree | 874042990f5c338a1295b255f90dc580b155462d /Build/source | |
parent | e765857100a75ca0752926e3d0f8e967b9b046a7 (diff) |
synctex: Check values returned by snprintf()
git-svn-id: svn://tug.org/texlive/trunk@27266 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/web2c/synctexdir/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/synctexdir/synctex_main.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index 6ed7e4deeb8..120839a4423 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,4 +1,8 @@ -2012-02-03 Peter Breitenlohner <peb@mppmu.mpg.de> +2012-07-30 Peter Breitenlohner <peb@mppmu.mpg.de> + + * synctex_main.c (TEST): Check values returned by snprintf(). + +2012-06-30 Peter Breitenlohner <peb@mppmu.mpg.de> * synctex.c: Remove "# warning ..." line, because MSVC fails to interpret it. diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c index 2f4d3f8751a..3e3400ab87f 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_main.c +++ b/Build/source/texk/web2c/synctexdir/synctex_main.c @@ -1,5 +1,5 @@ /* -Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr +Copyright (c) 2008-2012 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -424,6 +424,11 @@ int synctex_view_proceed(synctex_view_params_t * Ps) { }\ buffer_cur += printed;size-=printed;\ printed = snprintf(buffer_cur,size,FORMAT,WHAT);\ + if((unsigned)printed >= (unsigned)size) {\ + synctex_help_view("Snprintf problem");\ + free(buffer);\ + return -1;\ + }\ buffer_cur += printed;size-=printed;\ *buffer_cur='\0';\ viewer = where+strlen(KEY);\ @@ -702,6 +707,11 @@ int synctex_edit_proceed(synctex_edit_params_t * Ps) { }\ buffer_cur += printed;size-=printed;\ printed = snprintf(buffer_cur,size,FORMAT,WHAT);\ + if((unsigned)printed >= (unsigned)size) {\ + synctex_help_edit("Snprintf problem");\ + free(buffer);\ + return -1;\ + }\ buffer_cur += printed;size-=printed;\ *buffer_cur='\0';\ Ps->editor = where+strlen(KEY);\ |