nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] segmentation fault when trying to browse to an inaccess


From: Benno Schulenberg
Subject: Re: [Nano-devel] segmentation fault when trying to browse to an inaccessible directory
Date: Fri, 03 Jun 2016 13:05:45 +0200

On Thu, Jun 2, 2016, at 14:01, Rishabh Dave wrote:
> I have figured 2 ways to solve this bug. I have tried them, patches
> are attached. Which method/approach should I use on to fix the bug?

I would have expected first an analysis of the root cause of the bug:
not checking the return value of get_full_path(), thus passing NULL
to read_the_list() which then tries to get the length of NULL.

(There is another occurrence of not checking the return value of
get_full_path().  I will fix that one.)

So, I would have expected something simple as in the first attached
patch.  That doesn't work, because, before the message is printed,
the inaccessible directory has already been opened and makes the
current one appear to be empty.

So we move that opendir() to the beginning of the loop, as in the
second attached patch.  This is just a first try; I don't know how
it behaves in other silly situations, but for an inaccessible dir,
it does what I want.  So, test it, and tell me what is wrong with it.

Benno

-- 
http://www.fastmail.com - mmm... Fastmail...

Attachment: 0001-browser-do-not-segfault-when-the-returned-path-is-NU.patch
Description: Text Data

Attachment: 0002-browser-do-not-try-to-open-a-directory-before-having.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]