bugGNU Wget - Bugs: bug #29898, Unterminated C string in...

 
 

bug #29898: Unterminated C string in http_atotm()

Submitter:  Noël Köthe <nok>
Submitted:  Mon 17 May 2010 02:50:20 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  gscrivano
Originator Name:  Open/Closed:  Closed
Release:  1.12 Operating System:  GNU/Linux
Reproducibility:  None Fixed Release:  None
Planned Release:  None Regression:  None
Work Required:  None Patch Included:  Yes
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 17 May 2010 02:50:20 PM UTC, original submission:  

http_atotm() does not copy the terminating NUL character of the locale string.  The following patch should fix this.

(l < sizeof savedlocale holds at this point, so l is at most 254, and there is room for NUL character, if I'm not mistaken.)

It's probably easier to just use xstrdup, by the way.

commit 1182dcd947bc5718af6a1c797a79487607fcfc9f
Author: Florian Weimer <fw@deneb.enyo.de>
Date:   Sun May 16 11:57:52 2010 +0200

    http_atotm(): also copy terminating NUL character

diff --git a/src/http.c b/src/http.c
index 15e1caf..e7dc830 100644
--- a/src/http.c
+++ b/src/http.c
@@ -2928,7 +2928,7 @@ http_atotm (const char *time_string)
       if (l >= sizeof savedlocale)
         savedlocale[0] = '\0';
       else
-        memcpy (savedlocale, oldlocale, l);
+        memcpy (savedlocale, oldlocale, l + 1);
     }
   else savedlocale[0] = '\0';
 

forwarded from http://bugs.debian.org/581817

Noël Köthe <nok>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gscrivano (Updated the item)
  • -email is unavailable- added by nok (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-05-23 gscrivano StatusNone Fixed
        Assigned toNone gscrivano
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code