Compare commits

...

4 Commits

Author SHA1 Message Date
Benoît Dejean
3f49e555fc Released 2.14.6.
2007-01-14  Benoît Dejean  <benoit@placenet.org>

	* NEWS:

	Released 2.14.6.

svn path=/trunk/; revision=2547
2007-01-14 19:28:24 +00:00
Benoît Dejean
e156172e7c Fixed stack overflow in proc_map. Switched to Glibc getline because fgets
2007-01-14  Benoît Dejean  <benoit@placenet.org>

	* procmap.c: (glibtop_get_proc_map_s):
	* procopenfiles.c: (parse_file):

	Fixed stack overflow in proc_map.
	Switched to Glibc getline because fgets gets fooled by long
	lines.
	Closes #396477.

svn path=/trunk/; revision=2546
2007-01-14 18:09:56 +00:00
Benoît Dejean
c9385972bd Bumped version number to 2.14.6.
2007-01-11  Benoît Dejean  <benoit@placenet.org>

	* configure.in:
	
	Bumped version number to 2.14.6.
	
	* *:
	
	Got rid of CVS admin files.

svn path=/trunk/; revision=2545
2007-01-11 20:35:33 +00:00
Benoît Dejean
b411ee115f Replaced two strstr by a hand-written loop in this critical code.
2007-01-11  Benoît Dejean  <benoit@placenet.org>

	* glibtop_private.c: (get_scaled):
	
	Replaced two strstr by a hand-written loop in this critical code.

svn path=/trunk/; revision=2544
2007-01-11 20:28:02 +00:00
30 changed files with 71 additions and 288 deletions

View File

@@ -1,48 +0,0 @@
Makefile
Makefile.in
aclocal.m4
config.cache
config.h
config.h.in
config.log
config.sub
config.guess
config.status
configure
gtopConf.sh
i386-bsdi
i686-pc-linux-gnu
intl
libgtop-mirror.sh.swp
libgtopConf.sh
libtool
ltconfig
ltmain.sh
macros
stamp-h
stamp-h.in
sun4
sun4sol2
support
i386-freebsd
alpha-dec-osf3.0
i686-pc-linux-gnu-linux
libgtop-config
ABOUT-NLS
libgtop.spec
libgtop*.tar.gz
*-debstamp
libgtop*.pc
autom4te.cache
COPYING
INSTALL
install-sh
missing
mkinstalldirs
libgtopconfig.h
intltool-extract.in
intltool-extract
intltool-merge.in
intltool-merge
intltool-update.in
intltool-update

View File

@@ -1,3 +1,19 @@
2007-01-14 Benoît Dejean <benoit@placenet.org>
* NEWS:
Released 2.14.6.
2007-01-11 Benoît Dejean <benoit@placenet.org>
* configure.in:
Bumped version number to 2.14.6.
* *:
Got rid of CVS admin files.
2006-12-03 Benoît Dejean <benoit@placenet.org>
* doc/reference/libgtop-docs.xml:

7
NEWS
View File

@@ -1,3 +1,10 @@
January 14, 2007: Overview of changes in 2.14.6
===============================================
* linux:
- fixed stack overflow in glibtop_get_proc_map
- fixed handling of long filenames in glibtop_get_proc_map and glibtop_get_proc_open_files.
- micro-optimization
December 3, 2006: Overview of changes in 2.14.5
===============================================
* Added kfreebsd support (Petr Salinger <Petr.Salinger@seznam.cz>).

View File

@@ -4,7 +4,7 @@ dnl
m4_define([libgtop_major_version], [2])
m4_define([libgtop_minor_version], [14])
m4_define([libgtop_micro_version], [5])
m4_define([libgtop_micro_version], [6])
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
dnl increment if the interface has additions, changes, removals.

9
debian/.cvsignore vendored
View File

@@ -1,9 +0,0 @@
control
rules
build
tmp
*.postinst
*.debhelper
*.files
files
substvars

View File

@@ -1,11 +0,0 @@
texinfo.tex
*.info
Makefile.in
Makefile
*.log *.toc *.dvi *.aux *.cp *.fn *.vr *.tp *.ky *.pg
*.ps
auto-macros.texi
version.texi
stamp-vti
*.html *.pdf
mdate-sh

View File

@@ -1,27 +0,0 @@
.deps
.libs
Makefile
Makefile.in
first
first_linux
first_static
second
third
third_linux
third_static
second_static
second_linux
smp_static sysdeps_static netload_static procmap_static mountlist_static
smp sysdeps netload procmap mountlist
timings timings_static
pprint
pprint_static
procargs
procargs_static
proclist
df
df_static
netlist
netlist_static
openfiles
openfiles_static

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,8 +0,0 @@
.deps
.libs
Makefile
Makefile.in
libgtop.la
*.lo
lib.c
error.loT

View File

@@ -1,2 +0,0 @@
Makefile.in
Makefile

View File

@@ -1,14 +0,0 @@
*.gmo
*.mo
*.pot
Makefile
Makefile.in
Makefile.in.in
POTFILES
cat-id-tbl.c
messages
missing
notexist
po2tbl.sed
po2tbl.sed.in
stamp-cat-id

View File

@@ -1,2 +0,0 @@
Makefile.in
Makefile

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,7 +0,0 @@
Makefile.in
Makefile
libgtop_daemon2
libgtop_server2
server.conf
.libs
.deps

View File

@@ -1,5 +0,0 @@
Makefile.in
Makefile
mkinodedb2
file_by_inode2
.deps

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,8 +0,0 @@
.deps
.libs
Makefile
Makefile.in
libgtop_common.la
so_locations
*.lo
*.la

View File

@@ -1,6 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.lo
*.la

View File

@@ -1,6 +0,0 @@
.deps
.libs
Makefile
Makefile.in
libgtop_sysdeps.la
*.lo

View File

@@ -1,3 +1,19 @@
2007-01-14 Benoît Dejean <benoit@placenet.org>
* procmap.c: (glibtop_get_proc_map_s):
* procopenfiles.c: (parse_file):
Fixed stack overflow in proc_map.
Switched to Glibc getline because fgets gets fooled by long
lines.
Closes #396477.
2007-01-11 Benoît Dejean <benoit@placenet.org>
* glibtop_private.c: (get_scaled):
Replaced two strstr by a hand-written loop in this critical code.
2006-09-11 Benoît Dejean <benoit@placenet.org>
* procmap.c: (glibtop_get_proc_map_s):

View File

@@ -25,10 +25,16 @@ get_scaled(const char *buffer, const char *key)
{
ptr += strlen(key);
value = strtoull(ptr, &next, 0);
if (strchr(next, 'k'))
value *= 1024;
else if (strchr(next, 'M'))
value *= 1024 * 1024;
for ( ; *next; ++next) {
if (*next == 'k') {
value *= 1024;
break;
} else if (*next == 'M') {
value *= 1024 * 1024;
break;
}
}
} else
g_warning("Could not read key '%s' in buffer '%s'",
key, buffer);

View File

@@ -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 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
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,32 +154,28 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
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;
if(rv == 7) /* no filename */
filename[0] = '\0';
filename = line + line_end;
g_strstrip(filename);
/* Compute access permissions. */
@@ -217,6 +215,7 @@ glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
}
free(line);
fclose (maps);
buf->flags = _glibtop_sysdeps_proc_map;

View File

@@ -58,7 +58,8 @@ static void
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 @@ parse_file(const char *filename, LineParser parser, GHashTable *dict)
return;
}
/* skip the first line */
if(!fgets(line, sizeof line, f)) goto eof;
while(fgets(line, sizeof line, f))
{
/* skip the first line */
if (getline(&line, &size, f) == -1)
goto eof;
while (getline(&line, &size, f) != -1)
parser(dict, line);
}
eof:
free(line);
fclose(f);
}

View File

@@ -1,21 +0,0 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
libgtop_sysdeps.la
libsysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
proclist.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.lo
so_locations
*.lo
*.la

View File

@@ -1,7 +0,0 @@
.deps
.libs
Makefile
Makefile.in
libgtop_sysdeps.la
*.lo
libgtop_sysdeps_suid.la

View File

@@ -1,27 +0,0 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
init.lo
libgtop_sysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.lo
*.lo
so_locations

View File

@@ -1,28 +0,0 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
init.lo
libgtop_sysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
prockernel.lo
proclist.lo
procmem.lo
procsegment.lo
procsignal.lo
procstate.lo
proctime.lo
procuid.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.lo
*.lo
*.la
so_locations

View File

@@ -1,17 +0,0 @@
.deps
.libs
Makefile
Makefile.in
close.lo
cpu.lo
libgtop_sysdeps.la
loadavg.lo
mem.lo
msg_limits.lo
open.lo
proclist.lo
sem_limits.lo
shm_limits.lo
swap.lo
sysdeps.lo
uptime.lo