Menu

#51 Long Names = Array Overflow

open
nobody
General (29)
5
2009-01-24
2009-01-24
Tim
No

Some of our friendly yahoo users have decided to make bots with names (usually xn-) that are longer than 63 characters. This presents a problem when entering a room with one of these bots. The character arrays in users.c (and any other files I don't know of) should be changed to about 128 characters to allow for this, otherwise gyachi will exit when entering a room with a segmentation fault...

char *get_screenname_alias(char *user) {
char tmp_user[64];
gchar tmp_alias[64];
char *ptr = NULL;

if ( ! screenname_alias ) { return strdup(user); }
strncpy( tmp_user, user , 63 );
lower_str( tmp_user );

becomes...

char *get_screenname_alias(char *user) {
char tmp_user[128];
gchar tmp_alias[128];
char *ptr = NULL;

if ( ! screenname_alias ) { return strdup(user); }
strncpy( tmp_user, user , 127 );
lower_str( tmp_user );

I've counted upwards of 100 characters in some of these bot names. Thanks for listening. =D

Discussion


Log in to post a comment.

MongoDB Logo MongoDB