Assertion failed in request_list.c

Matthias Ruttmann ruttmann at bartels.de
Tue Aug 16 11:38:55 CEST 2005


> > the pointer new_queue is typed, the add operator imlpizit multiplies with
> > the size of *new_queue and the code doubles the multiplication.
> > => memset zeros an area far behind the queue
>
>   I don't agree.  That code is OK.
>

Just to avoid misunderstanding: Of course the problem is solved as soon as the 
queue start/end is adjusted properly, because the uninitialized pointers 
aren't used any more.

But also the memset statement itself is errornous. Currently the code uses 
case 4, but it should use case 3. 

#include <stdio.h>
int main(int argc, char ** argv)
{
	struct struct Stest {
		int x1;
		int x2;
	} t[200];
	printf("case 1: Stest: %p\n", t);
	printf("case 2: &Stest[100]: %p\n", &t[100]);
	printf("case 3: Stest + 100: %p\n", t + 100);
	printf("case 4: Stest + 100 * sizeof(Stest): %p\n", t + 100 * sizeof(*t));
	printf("case 5: Stest + 800: %p\n", t + 800);
	return 0;
}

Matthias Ruttmann




More information about the Freeradius-Devel mailing list