Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: hist: remove wrong NULL terminator



On Fri, Jan 9, 2015 at 6:45 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> On 01/09/2015 04:43 AM, Mikael Magnusson wrote:
>>
>> This actually writes a NULL to some arbitrary location in the caller
>> function's stack. Found by Coverity (Issue 1255746).
>>
>> The start of the quote() function does char **str = tr; and is called like
>> this,
>> quote(&sline);
>> sline in turn is just a char *sline;
>> The result of str[1] = NULL; is then, as far as I can tell, not anything
>> good. I also can't see any other thing that might have been intended to be
>> NULL-terminated here, so just remove it.
>
>
> Holy Cow.  That's just been sitting there for god knows how long?

Yes, but it's actually pretty harmless, most other variables on the
stack in that function are never used if we enter this codepath.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author