Closed Bug 51056 Opened 24 years ago Closed 24 years ago

error in reading unreachable preferences file

Categories

(Core :: Preferences: Backend, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: buster, Assigned: dveditz)

Details

(Whiteboard: [nsbeta3+]reviewed patch in hand)

Attachments

(1 file)

from the original posting by Nigel Cole <N.Cole@sc98c.demon.co.uk> on 
netscape.public.mozilla.seamonkey:

I think there's a problem in the code for reading the preferences file.

According to:

http://lxr.mozilla.org/seamonkey/source/modules/libpref/src/prefapi.c#265

the preferences file is read using an fread in pref_OpenFile, but the
return value isn't checked (line 291); in the event of a system problem,
the fread can return 0 and the code continues assuming a fileLength of 0.
(I'm bumping into this a lot with Communicator, which presumably uses
similar code).

I believe this can be fixed by simply adding:

        if (fileLength == 0)
                ok = PREF_ERROR;
        else

before line 293.

System: Networked Sun SPARCs running Solaris 2.6, though the problem
could affect any system where the fread can fail and return 0.
Keywords: patch, review
OS: Windows NT → All
Hardware: PC → All
Component: Preferences → Preferences: Backend
Keywords: nsbeta3
Whiteboard: reviewed patch in hand
Actually preferences backend, I'll take this.
Nav triage team: reassigning to dveditz
Assignee: matt → dveditz
Ick, prefs shouldn't be using raw fread() anyway, it should be using NSPR 
wrappers.
Whiteboard: reviewed patch in hand → [nsbeta3+]reviewed patch in hand
Patch checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Dan, you said that the prefs shouldn't be using raw fread(), they should be 
using NSPR wrappers. Did you file a bug on that, or should I do it?

No, I didn't file a but against the File i/o used in the low-level prefs.
backend fix, so rubberstamp vrfy.
Status: RESOLVED → VERIFIED
Bug 53021 filed on the use of fread() instead of NSPR wrappers....
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: