diff --git a/debian/changelog b/debian/changelog index 0fd17d6c..12604ef7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,11 @@ -libgtop2 (2.14.4-3) UNRELEASED; urgency=low +libgtop2 (2.14.4-3) unstable; urgency=high + * Urgency high for etch-targetted bugfix. * Add a get-orig-source target to retrieve the upstream tarball. + * New patch, 20_glibtop_get_proc_map-stack-overflow, fixes a stack overflow + in get_proc_map-stack(); from upstream SVN r2546; thanks Benoît Dejean. - -- Loic Minier Sat, 13 Jan 2007 23:33:24 +0100 + -- Loic Minier Sun, 14 Jan 2007 21:18:52 +0100 libgtop2 (2.14.4-2) unstable; urgency=low diff --git a/debian/patches/20_glibtop_get_proc_map-stack-overflow.patch b/debian/patches/20_glibtop_get_proc_map-stack-overflow.patch new file mode 100644 index 00000000..ad3fbb33 --- /dev/null +++ b/debian/patches/20_glibtop_get_proc_map-stack-overflow.patch @@ -0,0 +1,108 @@ +Index: sysdeps/linux/procmap.c +=================================================================== +--- sysdeps/linux/procmap.c (révision 2545) ++++ sysdeps/linux/procmap.c (révision 2546) +@@ -38,7 +38,7 @@ + #define SMAPS_FILE "/proc/%u/smaps" + + +-#define PROC_MAPS_FORMAT "%16llx-%16llx %4c %16llx %02hx:%02hx %llu%*[ ]%[^\n]\n" ++#define PROC_MAPS_FORMAT "%16llx-%16llx %4c %16llx %02hx:%02hx %llu%*[ ]%n" + + + static const unsigned long _glibtop_sysdeps_proc_map = +@@ -132,6 +132,8 @@ + FILE *maps; + const char *filename; + gboolean has_smaps; ++ char *line = NULL; ++ size_t line_size = 0; + + glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0); + +@@ -152,33 +154,29 @@ + + while(TRUE) + { +- char line[1024]; +- + unsigned long perm = 0; +- int rv; + guint len; ++ int line_end; + + unsigned short dev_major, dev_minor; + guint64 start, end, offset, inode; + char flags[4]; +- char filename [GLIBTOP_MAP_FILENAME_LEN+1]; ++ char *filename; + + glibtop_map_entry *entry; + +- if (!fgets(line, sizeof line, maps)) ++ if (getline(&line, &line_size, maps) == -1) + break; + + /* 8 arguments */ +- rv = sscanf(line, PROC_MAPS_FORMAT, +- &start, &end, flags, &offset, +- &dev_major, &dev_minor, &inode, filename); ++ if (sscanf(line, PROC_MAPS_FORMAT, ++ &start, &end, flags, &offset, ++ &dev_major, &dev_minor, &inode, &line_end) != 7) ++ break; + +- if(rv == EOF || rv < 7) +- break; ++ filename = line + line_end; ++ g_strstrip(filename); + +- if(rv == 7) /* no filename */ +- filename[0] = '\0'; +- + /* Compute access permissions. */ + + if (flags [0] == 'r') +@@ -217,6 +215,7 @@ + + } + ++ free(line); + fclose (maps); + + buf->flags = _glibtop_sysdeps_proc_map; +Index: sysdeps/linux/procopenfiles.c +=================================================================== +--- sysdeps/linux/procopenfiles.c (révision 2545) ++++ sysdeps/linux/procopenfiles.c (révision 2546) +@@ -58,7 +58,8 @@ + parse_file(const char *filename, LineParser parser, GHashTable *dict) + { + FILE *f; +- char line[1024]; ++ char *line = NULL; ++ size_t size = 0; + + f = fopen(filename, "r"); + +@@ -67,15 +68,16 @@ + return; + } + ++ + /* skip the first line */ +- if(!fgets(line, sizeof line, f)) goto eof; ++ if (getline(&line, &size, f) == -1) ++ goto eof; + +- while(fgets(line, sizeof line, f)) +- { ++ while (getline(&line, &size, f) != -1) + parser(dict, line); +- } + + eof: ++ free(line); + fclose(f); + } +