|Summary:||games-util/nforenum crashes when $HOME ends in a slash|
|Product:||Gentoo Linux||Reporter:||David Leverton <levertond>|
|Component:||[OLD] Games||Assignee:||Gentoo Games <games>|
|Package list:||Runtime testing required:||---|
Description David Leverton 2010-06-08 20:19:26 UTC
If the value of the HOME environment variable ends in a /, nforenum dies with an assertion failure (it may not do so for all input files, but it does for ogfxe_extra.nfo from games-misc/opengfx-0.2.4): [NFORENUM] ogfxe_extra.nfo NFORenum v3.4.6 r0 - Copyright 2004-2009 Dale McCoy. Processing file "ogfxe_extra.nfo". Failed to open data file: ".renum/79Dv.dat". (21) Is a directory renum: data.cpp:693: FILE* tryopen(const char*, const char*, bool): Assertion `false' failed. The problem is the following segment of code, which is run on the contents of $HOME, in an attempt to trim the trailing slash: if(dir[dir.length()-1]=='\\'||dir[dir.length()-1]=='/') dir[dir.length()-1]='\0'; Since dir is a C++ std::string, it doesn't work to overwrite the last character with a NUL - this just results in a string with a NUL as its last character. When appending the "/.renum/79Dv.dat" part, this results in "/foo\0/.renum/79Dv.dat", then when trying to open it as a filename the kernel truncates it at the NUL and tries to open the /foo directory as a file, which fails. The attached patch fixes this.
Comment 1 David Leverton 2010-06-08 20:19:56 UTC
Created attachment 234583 [details, diff] nforenum-0_pre2309-string.patch Fix
Comment 2 Mr. Bones. (RETIRED) 2010-06-08 20:25:45 UTC
in portage. thanks for the bug report and patch.