library/src/decoders/HTML/BP-HTMLDecoder.cc
// TODO: (appears to be unused, perhaps remove?) Duplicates an anchor list with new memory and pointers (used for attacks)
(appears to be unused, perhaps remove?) Duplicates an anchor list with new memory and pointers (used for attacks)
( appears to be unused perhaps remove? ) Duplicates an anchor list with new memory and pointers ( used for attacks )
P_BP_HTML_ANCHOR_LIST HTMLDuplicateAnchorVariables(P_BP_HTML_ANCHOR_VAR_LIST vars, P_BP_GARBAGE_COLLECTOR_DATA gc){
	if(!vars)
		return NULL;
	P_BP_HTML_ANCHOR_VAR_LIST tmpList = vars;
	P_BP_HTML_ANCHOR_VAR_LIST newList = NULL;
	bool isFirst;
	for(tmpList = tmpList->first;
		tmpList != NULL;
		tmpList = tmpList->next){
		if(tmpList->prev == NULL)
			isFirst = true;
		else
			isFirst = false;
		if(isFirst){
			newList = (P_BP_HTML_ANCHOR_VAR_LIST) BP_calloc(gc, NULL, sizeof(P_BP_HTML_ANCHOR_VAR_LIST), 1);
			if(!newList)
				return NULL;
			newList->prev  = NULL;
			newList->first = newList;
			newList->next  = NULL;
		} else {
			newList->next = (P_BP_HTML_ANCHOR_VAR_LIST) BP_calloc(gc, NULL, sizeof(P_BP_HTML_ANCHOR_VAR_LIST), 1);
			newList->next->prev = newList;
			newList->next->first = newList->first;
			newList = newList->next;
		}
		memcpy(newList, tmpList, sizeof(BP_HTML_ANCHOR_LIST));
	}
	return NULL;
}
P_BP_HTML_ANCHOR_LIST HTMLDuplicateAnchorVariables ( P_BP_HTML_ANCHOR_VAR_LIST vars , P_BP_GARBAGE_COLLECTOR_DATA gc ) { if ( ! vars ) return NULL ; P_BP_HTML_ANCHOR_VAR_LIST tmpList = vars ; P_BP_HTML_ANCHOR_VAR_LIST newList = NULL ; bool isFirst ; for ( tmpList = tmpList -> first ; tmpList != NULL ; tmpList = tmpList -> next ) { if ( tmpList -> prev == NULL ) isFirst = true ; else isFirst = false ; if ( isFirst ) { newList = ( P_BP_HTML_ANCHOR_VAR_LIST ) BP_calloc ( gc , NULL , sizeof ( P_BP_HTML_ANCHOR_VAR_LIST ) , 1 ) ; if ( ! newList ) return NULL ; newList -> prev = NULL ; newList -> first = newList ; newList -> next = NULL ; } else { newList -> next = ( P_BP_HTML_ANCHOR_VAR_LIST ) BP_calloc ( gc , NULL , sizeof ( P_BP_HTML_ANCHOR_VAR_LIST ) , 1 ) ; newList -> next -> prev = newList ; newList -> next -> first = newList -> first ; newList = newList -> next ; } memcpy ( newList , tmpList , sizeof ( BP_HTML_ANCHOR_LIST ) ) ; } return NULL ; }
TODO: (appears to be unused, perhaps remove?)
TODO : ( appears to be unused perhaps remove? )
// Null check // assigning anchor list // actual list // used for assigning pointers below // Walk the varlist and recreate elements // determine if we're at the lists first position // reassign the pointers // allocate space for the new element // Set arbitrary list pointers // if its not first, allocate space for next and move pointer up // append list item and move list up // copy in the old list