Re: strange problem with self-compiled software on FC 5 T2...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick von der Hagen wrote:
Ulrich Drepper wrote:

Patrick von der Hagen wrote:

Now, whom should I contact? glibc, gnu-c or gnu-c++?


Nobody but the person who wrote that code.  You pass a pointer to a
'char' variable for the %s format element.  Even *if* you only read one
character the terminating NUL byte will overwrite the next byte.  That's
likely your variable 'j'.

It's really amazing how many people missed that one and that several compilers (e.g. gnu-gcc/g++ 3.5) produced binaries that worked flawlessly. But you are right, "c" was placed next to "j" in memory, so j has been damaged by invocing fscanf. Fixing the format-string solved my problems.

Sorry for all that noise.

I was suspicious, but my understanding of C is pretty limited (and will stay that way; I reckon I know enough to know its failings).

Depending on the compiler, different optimisations could also hide/reveal the problem.

It might be possible for the compiler to do better consistency checking, but that won't help where the format string is created at run-time.

--

Cheers
John

-- spambait
1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx  Z1aaaaaaa@xxxxxxxxxxxxxxxxxxxxxxx
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/

do not reply off-list

--
fedora-test-list mailing list
fedora-test-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-test-list

[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]