From: Julian S. <js...@ac...> - 2007-03-11 18:31:57
|
On Sunday 11 March 2007 14:20, Julian Seward wrote: > On Sunday 11 March 2007 13:58, Dirk Mueller wrote: > > On Sunday, 11. March 2007, sv...@va... wrote: > > > It appears glibc-2.5's getenv() function steps along environment > > > strings in 16-bit chunks, which can cause false errors > > > > Are you sure that they're false? > > Well, um, err, not sure. Good question. Maybe glibc's getenv is fine and the problem is there are invalid strings in the environment. The only way I can reproduce this is to add (putenv) a non-terminated string containing just '=' and then do a getenv: #include <stdlib.h> #include <assert.h> #include <stdio.h> int main ( void ) { int r; char* p; p = malloc(1); assert(p); p[0] = '='; r = putenv(p); assert(r == 0); p = getenv("XYZZY"); printf("p = %p\n", p); return 0; } gives ==27447== Invalid read of size 2 ==27447== at 0x4E593FD: getenv (in /lib64/libc-2.5.so) ==27447== by 0x4006A5: main (nullenv.c:14) ==27447== Address 0x4049030 is 0 bytes inside a block of size 1 alloc'd ==27447== at 0x4C22A76: malloc (vg_replace_malloc.c:207) ==27447== by 0x400655: main (nullenv.c:10) Passing any kind of properly terminated string to putenv makes the error go away. So perhaps the environment is constructed wrongly. The first sign of trouble in a KDE run is this: (4) ==27107== Invalid read of size 2 (4) ==27107== at 0x6DE43FD: getenv (in /lib64/libc-2.5.so) (4) ==27107== by 0x4082D7: (within /opt/kde3/bin/kdeinit) (4) ==27107== by 0x408CCE: (within /opt/kde3/bin/kdeinit) (4) ==27107== by 0x6DCFAE3: (below main) (in /lib64/libc-2.5.so) (4) ==27107== Address 0x40708e0 is 0 bytes inside a block of size 1 alloc'd (4) ==27107== at 0x4C22A76: malloc (vg_replace_malloc.c:207) (4) ==27107== by 0x6E25AB1: strdup (in /lib64/libc-2.5.so) (4) ==27107== by 0x404E20: (within /opt/kde3/bin/kdeinit) (4) ==27107== by 0x408CBD: (within /opt/kde3/bin/kdeinit) (4) ==27107== by 0x6DCFAE3: (below main) (in /lib64/libc-2.5.so) Are there debuginfo packages available for KDE on SuSE 10.2 so we can find out who is calling strdup? J |