bugGNU Wget - Bugs: bug #25316, Bad setlocale behaviour

 
 

bug #25316: Bad setlocale behaviour

Submitted by:  Benjamin Wolsey <bwy>
Submitted on:  Wed 14 Jan 2009 10:58:59 AM UTC  
 
Category: Program LogicSeverity: 3 - Normal
Priority: 7 - HighStatus: Fixed
Privacy: PublicAssigned to: Micah Cowan <micahcowan>
Originator Name: Open/Closed: Closed
Release: trunkOperating System: GNU/Linux
Reproducibility: Every TimeFixed Release: None
Planned Release: 1.12Regression: None
Work Required: NonePatch Included: Yes

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 12 Jun 2009 02:04:31 AM UTC, comment #1:

Fixed in 76ff27f25b5d

Micah Cowan <micahcowan>In charge of this item.
Wed 14 Jan 2009 10:58:59 AM UTC, original submission:

For current trunk.

In http.c http_atotm(), the following happens:

const char* oldlocale = setlocale(LC_TIME, NULL);
setlocale(LC_TIME, "C");
setlocale(LC_TIME, oldlocale);

The second call to setlocale can change what oldlocale points to, however, so there are illegal reads whenever the initial locale is not C.

It more or less works anyway, as *oldlocale becomes NULL, so the third call to setlocale restores the user locale by treating it as "".

To reproduce, wget any http URL with LC_ALL not set to C locale and look at valgrind output.

I've attached a patch that fixes the read error by copying the string, but it does this on every call to http_atotm() so isn't particularly great.

Benjamin Wolsey <bwy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #17255:  setlocale.patch added by bwy (771B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by micahcowan (Updated the item)
  • -unavailable- added by bwy (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 12 Jun 2009 02:04:31 AM UTCmicahcowanStatusReady for Merge=>Fixed
      Open/ClosedOpen=>Closed
    Fri 16 Jan 2009 12:47:16 AM UTCmicahcowanCategoryNone=>Program Logic
      Priority5 - Normal=>7 - High
      StatusNone=>Ready for Merge
      Assigned toNone=>micahcowan
      Planned ReleaseNone=>1.12
    Wed 14 Jan 2009 10:59:00 AM UTCbwyAttached File-=>Added setlocale.patch, #17255

    Back to the top


    Powered by Savane 3.1-cleanup1