Summary: | `man -k` seg faults if its argument contains multiple words | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Ivan Raikov <raikov> |
Component: | [OLD] Core system | Assignee: | Martin Schlemmer (RETIRED) <azarah> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | High | ||
Version: | 1.3 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | man-1.5k-util_c-segfault.patch |
Description
Ivan Raikov
2002-10-27 09:12:21 UTC
Created attachment 6746 [details, diff] 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). 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. Fixed. |