First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 9761
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Martin Schlemmer (RETIRED) <azarah@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Ivan Raikov <raikov@cc.gatech.edu>
Add CC:
CC:
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
man-1.5k-util_c-segfault.patch man-1.5k-util_c-segfault.patch patch Martin Schlemmer (RETIRED) 2002-12-26 12:55 0000 2.22 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 9761 depends on: Show dependency tree
Bug 9761 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2002-10-27 09:12 0000
$ man -k blah       
blah: nothing appropriate

$ man -k "blah blah"
sh: unsafe: command not found
Error executing formatting or display command.
System command unsafe exited with status 127.
Segmentation fault

$ man --version
man, version 1.5k

------- Comment #1 From Martin Schlemmer (RETIRED) 2002-12-26 12:55:57 0000 -------
Created an attachment (id=6746) [edit]
man-1.5k-util_c-segfault.patch

  26 Dec 2002; Martin Schlemmer <azarah@gentoo.org> man-1.5k.ebuild,
						    man-1.5k-r1.ebuild :

  Bugfixes:
  - Add man-1.5k-util_c-segfault.patch to fix a crash when calling man
    with:  man -k "foo bar" (bug #9761).

------- Comment #2 From Martin Schlemmer (RETIRED) 2002-12-26 12:58:58 0000 -------
The reason for this is that my_xsprintf() in util.c passes
NOT_SAFE as the result if the string is not shell safe.
When do_appros() (or whatever) then calls 'free(command)',
free() tries to free a constant, and segfault.

The attached solution are not eligant, but works without
breaking the API.  Basically we redefine NOT_SAFE as a
message that we want to display, prepended with 'echo'.
When the command is then executed, our message are displayed,
and not the the line containing:
  
  sh: line 1: unsafe: command not found

Further more, we do not return NOT_SAFE, but rather a string
that we malloc, and then fill with the contents of NOT_SAFE,
which will solve us trying to free a constant.

Alternatively it is possible to redefine what is "shell safe",
but that will me a much more comprehensive fix ...

-----
$ man -k "blah blah"
Cannot run command, as it is not shell safe!
Check that you do not quote search strings, etc.

------- Comment #3 From Martin Schlemmer (RETIRED) 2002-12-29 11:42:39 0000 -------
Fixed.

First Last Prev Next    No search results available      Search page      Enter new bug