+-------------------------------------------------------------------
+Thu Sep 18 14:44:31 CEST 2008 - dmacvicar@suse.de
+
+- fix segfault in multiarch parsing (bnc#427271)
+
+-------------------------------------------------------------------
Wed Sep 17 14:10:23 CEST 2008 - mls@suse.de
- fix segfault in provides iterator
#include "util.h"
#include "repo_content.h"
+/* maximum number of architectures */
+#define MAX_MULTIARCH 25
+
/*
* split l into m parts, store to sp[]
* split at whitespace
we allow max 4 archs
*/
unsigned int numotherarchs = 0;
- Id otherarchs[4];
- for ( ; i < 4; ++i )
- otherarchs[i] = 0;
-
+ Id otherarchs[MAX_MULTIARCH];
+ memset(otherarchs, 0, MAX_MULTIARCH * sizeof(Id));
+
memset(&pd, 0, sizeof(pd));
line = sat_malloc(1024);
aline = 1024;
else if (istag ("BASEARCHS"))
{
char *sp[2];
-
+ int i = 0;
/* get the first architecture and use it
for the product arch */
int words = split(value, sp, 2);
s->arch = str2id(pool, sp[0], 1);
/* ignore the rest for now */
value = sp[1];
+ /* fprintf(stderr, "first arch is %s\n", sp[0]); */
- while ( value && (numotherarchs < 5) )
+ /* only if there were more than one arch */
+ if ( words > 1 )
{
- words = split(value, sp, 2);
- if (!words)
- break;
- /* we have a new extra architecture */
- numotherarchs++;
- otherarchs[numotherarchs - 1 ] = str2id(pool, sp[0], 1);
- if (words == 1)
- break;
- value = sp[1];
+ while ( value && (i < MAX_MULTIARCH) )
+ {
+ words = split(value, sp, 2);
+ if (!words)
+ break;
+ /* we have a new extra architecture */
+ otherarchs[i] = 0;
+ numotherarchs++;
+ otherarchs[i] = str2id(pool, sp[0], 1);
+ /* fprintf(stderr, "%d arch is %s\n", i, sp[0]); */
+
+ if (words == 1)
+ break;
+ value = sp[1];
+ i++;
+ }
}
}
}