[Debootloaders-devel] r104 - trunk/rsrce

Jeremie Koenig jkoenig-guest at costa.debian.org
Fri Jul 14 11:37:49 UTC 2006


Author: jkoenig-guest
Date: 2006-07-14 11:37:48 +0000 (Fri, 14 Jul 2006)
New Revision: 104

Modified:
   trunk/rsrce/resource.c
Log:
Nasty bug fixed: the type list offset in the map header points to the number of
types field before the actual list!


Modified: trunk/rsrce/resource.c
===================================================================
--- trunk/rsrce/resource.c	2006-07-13 01:19:33 UTC (rev 103)
+++ trunk/rsrce/resource.c	2006-07-14 11:37:48 UTC (rev 104)
@@ -310,9 +310,10 @@
 	return 0;
 }
 
-static int res_parse_typelist(struct res_parsecontext *c, int tn)
+static int res_parse_typelist(struct res_parsecontext *c)
 {
-	struct restype *l = (struct restype *) c->tbase;
+	uint16_t *tnp = (uint16_t *) c->tbase, tn = ntohs(*tnp) + 1;
+	struct restype *l = (struct restype *) (tnp + 1);
 	int i;
 
 	for(i=0 ; i < tn ; i++) {
@@ -337,7 +338,7 @@
 	c->dbase = c->buf + ntohl(rh->dofs);
 	c->tbase = (char *) mh + ntohs(mh->tlistofs);
 	c->nbase = (char *) mh + ntohs(mh->nlistofs);
-	return res_parse_typelist(c, ntohs(mh->tnum) + 1);
+	return res_parse_typelist(c);
 }
 
 struct res_fork *res_read(FILE *stream)





More information about the Debootloaders-devel mailing list