diff options
author | Joachim Schrod <jschrod@acm.org> | 2007-06-28 13:16:06 +0000 |
---|---|---|
committer | Joachim Schrod <jschrod@acm.org> | 2007-06-28 13:16:06 +0000 |
commit | 405dd674e335843ede7817de9697c50e696c13bb (patch) | |
tree | 11c9588ff570c15e9f2df109fc47d573c441be28 /Build/source/texk/dviljk/dvi2xx.h | |
parent | aeefc403ad4b686d3d937865747ed18de040cd4a (diff) |
Fix more buffer overflows: Ghostscript command construction, read
from files into static arrays.
git-svn-id: svn://tug.org/texlive/trunk@4524 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dviljk/dvi2xx.h')
-rw-r--r-- | Build/source/texk/dviljk/dvi2xx.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Build/source/texk/dviljk/dvi2xx.h b/Build/source/texk/dviljk/dvi2xx.h index 47fc31b36f4..15d37a59efa 100644 --- a/Build/source/texk/dviljk/dvi2xx.h +++ b/Build/source/texk/dviljk/dvi2xx.h @@ -282,7 +282,14 @@ char *MFMODE = MFMODE600; #define VisChar(c) (unsigned char)(c) #endif -#define GetBytes(fp,buf,n) read_multi(buf,1,n,fp) /* used to be a function */ +/* Used to be a function. buf is always an array, never a pointer. + Without that invariant, we would have to introduce full dynamic + memory management in this driver -- probably it would be easier to + write a new one. [27 Jun 07 -js] */ +#define GetBytes(fp,buf,n) \ + ( sizeof(buf) != sizeof(void *) && sizeof(buf) > n ? \ + read_multi(buf, 1, n, fp) \ + : Fatal("Try to read %d bytes in an array of size %d", n, sizeof(buf)) ) /**********************************************************************/ |