From: Araki K. <ara...@us...> - 2003-10-14 14:09:34
|
Hi, Subject: [Mlterm-dev-en] Segfault on Red Hat 9 plus patch. From: Peter Haight <pe...@sa...> Message-ID: <200...@wa...> Date: Mon, 13 Oct 2003 13:51:16 -0700 > I was getting a segfault everytime I started mlterm on Red Hat 9. I tracked > the problem down to a memory overflow bug in xwindow/x_font_cache.c. On my > system, in x_get_font_name_list_for_fontset, all of the custom font > functions return null. So when we get down to the realloc line, > font_name_list is null. This means that realloc completeley alocates a new > uninitialized memory block which isn't necessary all zeros. In my case it > was a long list of ???? which caused it to overwrite some other memory which > caused a crash later on. Thanks:D Actually I've already fixed the codes in CVS-head in a different point of view. But, stupidly, I didn't notice that they could cause such a serious problem. Oops... I'll soon release 2.8.1. > Anyway, here's a patch. I did sort of a minimal patch, but I highly > recommend always using snprintf instead of sprintf in the future which would > probably have made this bug easier to find. I don't know why snprintf makes it easier to find such a bug(because the buggy codes will work anyway by snprintf, maybe), but I agree snprintf is safer in this situation too. The problem is that snprintf is a not portable function, I'll replace sprintf with a wrapper function kik_snprintf. Regards, -- Araki Ken ara...@us... |