diff options
author | Egbert Eich <eich@suse.de> | 2004-01-29 08:07:56 +0000 |
---|---|---|
committer | Egbert Eich <eich@suse.de> | 2004-01-29 08:07:56 +0000 |
commit | 0c5c8c10d628f28943a9cde02fb079c486ed71a3 (patch) | |
tree | 3d454924a06bf8bd13777c6bc73abefa6cd635f0 | |
parent | f0345958208586004bee80bac057b651162b8a27 (diff) |
Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004xf86-4_3_99_903_specialxf86-012804-2330
-rw-r--r-- | src/FSFontInfo.c | 4 | ||||
-rw-r--r-- | src/FSFtNames.c | 10 | ||||
-rw-r--r-- | src/FSGetCats.c | 10 | ||||
-rw-r--r-- | src/FSListCats.c | 10 | ||||
-rw-r--r-- | src/FSListExt.c | 10 | ||||
-rw-r--r-- | src/FSOpenFont.c | 4 | ||||
-rw-r--r-- | src/FSOpenServ.c | 15 | ||||
-rw-r--r-- | src/FSQGlyphs.c | 18 | ||||
-rw-r--r-- | src/FSQXExt.c | 6 | ||||
-rw-r--r-- | src/FSQXInfo.c | 4 |
10 files changed, 66 insertions, 25 deletions
diff --git a/src/FSFontInfo.c b/src/FSFontInfo.c index f27b190..277d00e 100644 --- a/src/FSFontInfo.c +++ b/src/FSFontInfo.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFontInfo.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSFontInfo.c,v 1.6 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -244,8 +244,10 @@ FSListFontsWithXInfo(svr, pattern, maxNames, count, info, pprops, offsets, prop_ pi[i]->num_offsets = local_pi.num_offsets; pi[i]->data_len = local_pi.data_len; +#if SIZE_MAX <= UINT_MAX if (pi[i]->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) goto badmem; +#endif po[i] = (FSPropOffset *) FSmalloc(pi[i]->num_offsets * sizeof(FSPropOffset)); diff --git a/src/FSFtNames.c b/src/FSFtNames.c index 7460d9c..e3ad30d 100644 --- a/src/FSFtNames.c +++ b/src/FSFtNames.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSFtNames.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSFtNames.c,v 1.7 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -78,8 +78,12 @@ FSListFonts(svr, pattern, maxNames, actualCount) (SIZEOF(fsListFontsReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return (char **) 0; - if (rep.nFonts && rep.nFonts <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX >> 2)) { + if (rep.nFonts +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.nFonts <= SIZE_MAX / sizeof(char *) + && rep.length <= (SIZE_MAX >> 2) +#endif + ) { flist = (char **) FSmalloc((unsigned) rep.nFonts * sizeof(char *)); rlen = (rep.length << 2) - SIZEOF(fsListFontsReply); c = (char *) FSmalloc((unsigned) (rlen + 1)); diff --git a/src/FSGetCats.c b/src/FSGetCats.c index a80054d..5516d1b 100644 --- a/src/FSGetCats.c +++ b/src/FSGetCats.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSGetCats.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSGetCats.c,v 1.7 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -72,8 +72,12 @@ FSGetCatalogues(svr, num) SyncHandle(); return (char **) NULL; } - if (rep.num_catalogues && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX >> 2)) { + if (rep.num_catalogues +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.num_catalogues <= SIZE_MAX/sizeof(char *) + && rep.length <= (SIZE_MAX >> 2) +#endif + ) { list = (char **) FSmalloc((unsigned) (rep.num_catalogues * sizeof(char *))); rlen = (rep.length << 2) - SIZEOF(fsGetCataloguesReply); diff --git a/src/FSListCats.c b/src/FSListCats.c index dce37e5..e276a4b 100644 --- a/src/FSListCats.c +++ b/src/FSListCats.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListCats.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSListCats.c,v 1.7 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -78,8 +78,12 @@ FSListCatalogues(svr, pattern, maxNames, actualCount) (SIZEOF(fsListCataloguesReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return (char **) 0; - if (rep.num_catalogues && rep.num_catalogues <= SIZE_MAX/sizeof(char *) - && rep.length <= (SIZE_MAX>>2)) { + if (rep.num_catalogues +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.num_catalogues <= SIZE_MAX/sizeof(char *) + && rep.length <= (SIZE_MAX>>2) +#endif + ) { clist = (char **) FSmalloc((unsigned) rep.num_catalogues * sizeof(char *)); rlen = (rep.length << 2) - SIZEOF(fsListCataloguesReply); diff --git a/src/FSListExt.c b/src/FSListExt.c index ee87a1c..91e9639 100644 --- a/src/FSListExt.c +++ b/src/FSListExt.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSListExt.c,v 1.6 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSListExt.c,v 1.7 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -73,8 +73,12 @@ FSListExtensions(svr, next) SyncHandle(); return (char **) NULL; } - if (rep.nExtensions && rep.nExtensions <= SIZE_MAX / sizeof(char *) - && rep.length <= (SIZE_MAX>>2)) { + if (rep.nExtensions +#if (SIZE_MAX >> 2) <= UINT_MAX + && rep.nExtensions <= SIZE_MAX / sizeof(char *) + && rep.length <= (SIZE_MAX>>2) +#endif + ) { list = (char **) FSmalloc((unsigned)(rep.nExtensions * sizeof(char *))); rlen = (rep.length << 2) - SIZEOF(fsListExtensionsReply); c = (char *) FSmalloc((unsigned) rlen + 1); diff --git a/src/FSOpenFont.c b/src/FSOpenFont.c index 8c137d7..d87c5f9 100644 --- a/src/FSOpenFont.c +++ b/src/FSOpenFont.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ +/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.7 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -62,7 +62,7 @@ FSOpenBitmapFont(svr, hint, fmask, name, otherid) char *name; Font *otherid; { - unsigned char nbytes; + unsigned int nbytes; fsOpenBitmapFontReq *req; fsOpenBitmapFontReply reply; Font fid; diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c index a992a65..b364bf2 100644 --- a/src/FSOpenServ.c +++ b/src/FSOpenServ.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSOpenServ.c,v 1.8 2003/09/01 20:50:09 herrb Exp $ */ +/* $XFree86: xc/lib/FS/FSOpenServ.c,v 1.9 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -163,14 +163,20 @@ FSOpenServer(server) _FSRead(svr, (char *) alt_data, setuplength); ad = alt_data; +#if SIZE_MAX <= UINT_MAX if (prefix.num_alternates > SIZE_MAX / sizeof(AlternateServer)) { errno = ENOMEM; + FSfree((char *) alt_data); + FSfree((char *) svr); return (FSServer *) 0; } +#endif + alts = (AlternateServer *) FSmalloc(sizeof(AlternateServer) * prefix.num_alternates); if (!alts) { errno = ENOMEM; + FSfree((char *) alt_data); FSfree((char *) svr); return (FSServer *) 0; } @@ -198,10 +204,11 @@ FSOpenServer(server) svr->num_alternates = prefix.num_alternates; setuplength = prefix.auth_len << 2; - if (prefix.auth_len > (SIZE_MAX>>2) + if (setuplength > (SIZE_MAX>>2) || (auth_data = (char *) (setup = FSmalloc((unsigned) setuplength))) == NULL) { errno = ENOMEM; + FSfree((char *) alts); FSfree((char *) svr); return (FSServer *) NULL; } @@ -210,6 +217,7 @@ FSOpenServer(server) if (prefix.status != AuthSuccess) { fprintf(stderr, "%s: connection to \"%s\" refused by server\r\n%s: ", "FSlib", server, "FSlib"); + FSfree((char *) alts); FSfree((char *) svr); FSfree(setup); return (FSServer *) NULL; @@ -220,6 +228,8 @@ FSOpenServer(server) if ((vendor_string = (char *) FSmalloc((unsigned) conn.vendor_len + 1)) == NULL) { errno = ENOMEM; + FSfree((char *) auth_data); + FSfree((char *) alts); FSfree((char *) svr); return (FSServer *) NULL; } @@ -276,4 +286,3 @@ FSOpenServer(server) return (svr); } - diff --git a/src/FSQGlyphs.c b/src/FSQGlyphs.c index b13bdde..187ea16 100644 --- a/src/FSQGlyphs.c +++ b/src/FSQGlyphs.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQGlyphs.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSQGlyphs.c,v 1.6 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -85,20 +85,24 @@ FSQueryXBitmaps8(svr, fid, format, range_type, str, str_len, offsets, glyphdata) (SIZEOF(fsQueryXBitmaps8Reply) - SIZEOF(fsGenericReply)) >> 2, fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_chars > SIZE_MAX / sizeof(FSOffset)) return FSBadAlloc; +#endif offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); *offsets = offs; if (!offs) return FSBadAlloc; - left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps8Reply) - - (SIZEOF(fsOffset32) * reply.num_chars); +#if (SIZE_MAX >> 2) <= UINT_MAX /* XXX This thest is incomplete */ if (reply.length > (SIZE_MAX >> 2)) { FSfree((char *) offs); return FSBadAlloc; } +#endif + left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps8Reply) + - (SIZEOF(fsOffset32) * reply.num_chars); gd = (unsigned char *) FSmalloc(left); *glyphdata = gd; if (!gd) { @@ -170,19 +174,23 @@ FSQueryXBitmaps16(svr, fid, format, range_type, str, str_len, fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if(reply.num_chars > SIZE_MAX/sizeof(FSOffset)) return FSBadAlloc; +#endif offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars); *offsets = offs; if (!offs) return FSBadAlloc; - left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps16Reply) - - (SIZEOF(fsOffset32) * reply.num_chars); +#if (SIZE_MAX >> 2) <= UINT_MAX /* XXX - this test is incomplete */ if (reply.length > (SIZE_MAX>>2)) { FSfree((char *) offs); return FSBadAlloc; } +#endif + left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps16Reply) + - (SIZEOF(fsOffset32) * reply.num_chars); gd = (unsigned char *) FSmalloc(left); *glyphdata = gd; if (!gd) { diff --git a/src/FSQXExt.c b/src/FSQXExt.c index d288acd..5f23774 100644 --- a/src/FSQXExt.c +++ b/src/FSQXExt.c @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.7 2003/09/01 20:50:09 herrb Exp $ */ +/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.8 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -93,8 +93,10 @@ FSQueryXExtents8(svr, fid, range_type, str, str_len, extents) fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_extents > SIZE_MAX / sizeof(FSXCharInfo)) return FSBadAlloc; +#endif ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents); *extents = ext; @@ -152,8 +154,10 @@ FSQueryXExtents16(svr, fid, range_type, str, str_len, extents) fsFalse)) return FSBadAlloc; +#if SIZE_MAX <= UINT_MAX if (reply.num_extents > SIZE_MAX/sizeof(FSXCharInfo)) return FSBadAlloc; +#endif ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents); *extents = ext; diff --git a/src/FSQXInfo.c b/src/FSQXInfo.c index 3ee3449..953e6fc 100644 --- a/src/FSQXInfo.c +++ b/src/FSQXInfo.c @@ -23,7 +23,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/lib/FS/FSQXInfo.c,v 1.5 2003/10/23 15:23:24 tsi Exp $ */ +/* $XFree86: xc/lib/FS/FSQXInfo.c,v 1.6 2003/12/22 17:48:02 tsi Exp $ */ /* @@ -91,8 +91,10 @@ FSQueryXInfo(svr, fid, info, props, offsets, prop_data) props->num_offsets = local_pi.num_offsets; props->data_len = local_pi.data_len; +#if SIZE_MAX <= UINT_MAX if (props->num_offsets > SIZE_MAX / sizeof(FSPropOffset)) return FSBadAlloc; +#endif /* prepare for prop data */ offset_data = (FSPropOffset *) |