gaim/gaim

From David Kaelbling:
gtk1-stable
2002-12-13, Sean Egan
a1f5b0e3e0ee
Parents 0dfb2267f93e
Children 32d1fa6d0a23
From David Kaelbling:

Running gaim/0.59.6 on SGI IRIX 6.5, I had problems
with memory corruption until I made the attached
change. Basically when calling readdir_r the buffer
you supply should not be just a 'struct dirent' -- it
must be padded to the maximum allowed name length.
  • +2 -0
    ChangeLog
  • +4 -2
    src/perl.c
  • --- a/ChangeLog Sat Dec 07 12:53:43 2002 -0500
    +++ b/ChangeLog Fri Dec 13 21:41:17 2002 -0500
    @@ -4,6 +4,8 @@
    * Yahoo i18n fix (Thanks Ethan Blanton).
    * Fixed a bug in escaping saved passwords (Thanks
    Eric Timme)
    + * Fixed an overflow bug in perl script autoloading
    + (Thanks David Kaelbling)
    version 0.59.6 (11/07/2002):
    * Fixed a segfault introduced in 0.59.5 when gtk
    --- a/src/perl.c Sat Dec 07 12:53:43 2002 -0500
    +++ b/src/perl.c Fri Dec 13 21:41:17 2002 -0500
    @@ -178,14 +178,15 @@
    {
    DIR *dir;
    struct dirent *ent;
    - struct dirent dirent_buf;
    + struct dirent *dirent_buf;
    char *buf;
    char *path;
    path = gaim_user_dir();
    dir = opendir(path);
    if (dir) {
    - while ((readdir_r(dir,&dirent_buf,&ent),ent)) {
    + dirent_buf = g_malloc(sizeof(struct dirent) + NAME_MAX);
    + while ((readdir_r(dir,dirent_buf,&ent),ent)) {
    if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..")) {
    if (is_pl_file(ent->d_name)) {
    buf = g_malloc(strlen(path) + strlen(ent->d_name) + 2);
    @@ -196,6 +197,7 @@
    }
    }
    closedir(dir);
    + g_free(dirent_buf);
    }
    g_free(path);
    }