Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic issues #30

Open
4 of 32 tasks
sean-gilliam opened this issue Oct 15, 2019 · 0 comments
Open
4 of 32 tasks

Logic issues #30

sean-gilliam opened this issue Oct 15, 2019 · 0 comments
Labels

Comments

@sean-gilliam
Copy link
Collaborator

sean-gilliam commented Oct 15, 2019

Ongoing issue where we include logic issues found in the code:

act_info.c

void do_affects(CHAR_DATA *ch, char *argument )
{
...
if(paf->aftype!=AFT_INVIS);
    send_to_char( "\n\r", ch );
...
}

act_move.c

void move_char( CHAR_DATA *ch, int door, bool automatic, bool fcharm)
{
...
if(!automatic || automatic)
...
}
void do_acute_vision( CHAR_DATA *ch, char *argument )
{
...
return;
check_improve(ch,gsn_acute_vision,TRUE,1);
}

act_obj.c

bool can_loot(CHAR_DATA *ch, OBJ_DATA *obj)
{
...
return TRUE;
... more logic ...
}
void do_give( CHAR_DATA *ch, char *argument )
{
...
if((obj->pIndexData->iprogs->give_prog) (obj,ch,victim) == TRUE);
...
}

act_wiz.c

void do_owhere(CHAR_DATA *ch, char *argument )
{
...
for (in_obj = obj; in_obj->in_obj != NULL; in_obj = in_obj->in_obj);
...
}
void do_multicheck( CHAR_DATA *ch, char *argument)
{
...
return send_to_char("Fix later.\n\r",ch);
... more logic ...
}

ap.c

void lesser_demon_tick (CHAR_DATA *mob, AFFECT_DATA *af)
{
...
		case(MOB_VNUM_AAMON):
			if (af->duration == 4) {
				do_emote(mob,"taps his foot irritably.");
				break;
			}
			if (af->duration == 1) {
				do_emote(mob,"laughs giddily and whirls to leave.");
				RS.Queue.AddToQueue(1, 2, do_say,mob, (char*)"I'll be leaving now,  and leaving you to your thoughts.  You'll never know the answer to my riddle.");
				RS.Queue.AddToQueue(2, 5, act, "With a puff of hazy purple smoke and a sound like a cough, $n disappears.", mob, 0, 0, TO_ROOM);
				RS.Queue.AddToQueue(3, 1, delay_extract, mob);
				break;
			}
...
}
void insanity_pulse(CHAR_DATA *ch, AFFECT_DATA *af)
{
	...
	for(victim = ch->in_room->people; victim != NULL; victim = victim->next_in_room)
	{
		...
		switch(number_range(1, 5))
		{
			...
		}
		break;
	}
	...
}

comm.c

void close_socket( DESCRIPTOR_DATA *dclose )
{
...
for ( d = descriptor_list; d && d->next != dclose; d = d->next );
...
}
void read_from_buffer( DESCRIPTOR_DATA *d )
{
...
for ( j = 0; ( d->inbuf[j] = d->inbuf[i+j] ) != '\0'; j++ );
}
void nanny( DESCRIPTOR_DATA *d, char *argument )
{
...
      ch->race = race;

	/* initialize stats */

	ch->race=race;
...
}
void show_string(struct descriptor_data *d, char *input)
{
...
		for (chk = d->showstr_point; isspace(*chk); chk++);
	    {
			...
		}
...
}

db.c

void area_update( void )
{
...
 else if (paf->duration < 0);
...
}
char *fread_string( FILE *fp )
{
	...
    case EOF:
		/* temp fix */
        bug( "Fread_string: EOF", 0 );
	    return NULL;
        /* exit( 1 ); */
        break;
	...
}

Memory leak - file pointer never closed

void load_votes()
{
...
	if(!(fp=fopen(VOTE_FILE,"r")))
		return;
	return;
... more logic ...
}

devextra.c

void do_pswitch(CHAR_DATA *ch, char *argument)
{
...
	name[0] = UPPER(name[0]);
	return;
... more logic ...
}

SQL injection

void do_listoffer(CHAR_DATA *ch, char *argument)
{
...
	sprintf(query,"SELECT * FROM offerings WHERE deity = \"%s\" %s ORDER BY time ASC",
		ch->true_name, autol ? "AND status = 0" : "");
... more logic ...
}

SQL injection

void do_offer(CHAR_DATA *ch, char *argument)
{
...
		sprintf(query, "SELECT * FROM offerings WHERE deity = \"%s\" AND player = \"%s\" ORDER BY time DESC LIMIT 1",
			altar->in_room->owner, ch->true_name);
... more logic ...
}
void show_database_info(CHAR_DATA *ch, char *argument)
{
	MYSQL *conn, *conn2;
	MYSQL_RES *res_set, *res2;
	MYSQL_ROW row, row2;
	char query[MSL], buf[MSL], buf2[MSL];
	float lpercent;

	return;

... logic to show database info...
}
void do_demo(CHAR_DATA *ch, char *name)
{
...
	sprintf(buf,"There are currently %i limited items in the game (%i on players).\n\r",i,r);
	send_to_char(buf,ch);
	return;
... more logic ...
}
void plug_graveyard(CHAR_DATA *ch, int type)
{
    int minlevel=30,day, tid, i,max;
	char buf[MSL], buf2[MSL], name[MSL], message[MSL], message_date[MSL],stid[MSL];
	char align[MSL], ethos[MSL],type_death[MSL],message_death[MSL];
	char *suf;
	char ntime[MSL],year[MSL], month[MSL], dom[MSL], time[MSL],cur_date[MSL],unique[MSL];
	MYSQL_ROW qrow;


	return;
... more logic ...
}

Memory leak - sql pointer never closed

bool sort_votes(char *hold[], int *holdi, int cabal)
{
...
	return TRUE;
	mysql_free_result(res);
}

SQL injection - this method has several instances of sql injection

void do_vote(CHAR_DATA *ch, char *argument)
{
...
	sprintf(buf,"SELECT COUNT(voter) FROM votes WHERE voter='%s'", ch->true_name);
... more logic ...
	sprintf(buf,"SELECT vote_for FROM votes WHERE voter='%s'", ch->true_name);
... etc ...
}
bool check_volley(CHAR_DATA *ch, CHAR_DATA *victim)
{
	int skill, chance;
	//CH is caster of offensive spell, victim is victim
	return FALSE;
... more logic ...
}
void do_topbounties(CHAR_DATA *ch, char *argument)
{
	int i, pnum = 0, plus = 0;
	char buf[MAX_STRING_LENGTH];
	return;	
... more logic ...
}
void do_assess_old(CHAR_DATA *ch, char *argument)
{
...
	for ( paf = victim->affected; paf != NULL; paf = paf->next )
	{
		buf[0]='\0';
		if(skill<91);
		...
		if(skill>=91);
		...
	}
...
}

dioextra.c

void do_ctrack( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_STRING_LENGTH];
    char buf[MAX_STRING_LENGTH];
    char buf2[MAX_STRING_LENGTH];
    char newbuf[MAX_STRING_LENGTH];
    char results[MAX_STRING_LENGTH];
    char *login = NULL;
    FILE *fpChar;
    FILE *fpChar2;
    int numMatches = 0, cabal, counter;
    BUFFER *output;

    one_argument(argument, arg);

    output = new_buf();
    return;
... more logic ...
}

handler.c

int get_skill(CHAR_DATA *ch, int sn)
{
...
		} else if (ch->pIndexData->Class()->GetIndex() == CLASS_SORCERER) {
			;
		} else
...
}
bool room_is_private( ROOM_INDEX_DATA *pRoomIndex )
{
    CHAR_DATA *rch;
    int count;

    return FALSE;
... more logic ...
}

iprog.c

void invoke_prog_tattoo_dioxide(OBJ_DATA *obj, CHAR_DATA *ch, char *argument)
{
	AFFECT_DATA af;

        return;
... more logic ...
}

misc.c

void do_rngtest(CHAR_DATA *ch, char *argument)
{
	long total = 0;
	int count;
	int rolls, val, maxes = 0;
	char buf[MSL];

	for(count = 0; count < 100000; count++)
		update_db_gold();
	return;
... more logic ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant