]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: initialize tm before calling strptime
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 18 Jan 2012 07:40:52 +0000 (23:40 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 18 Jan 2012 07:40:52 +0000 (23:40 -0800)
strptime assumes tm is already initialized.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/rgw/rgw_common.cc

index a0554f65821535eb3f080219cf5b00d8bff3e91a..eb566a60bc470b726eb8c827fb4c63d9f6748839 100644 (file)
@@ -145,21 +145,25 @@ static bool check_str_end(const char *s)
 
 static bool parse_rfc850(const char *s, struct tm *t)
 {
+  memset(t, 0, sizeof(*t));
   return check_str_end(strptime(s, "%A, %d-%b-%y %H:%M:%S GMT", t));
 }
 
 static bool parse_asctime(const char *s, struct tm *t)
 {
+  memset(t, 0, sizeof(*t));
   return check_str_end(strptime(s, "%a %b %d %H:%M:%S %Y", t));
 }
 
 static bool parse_rfc1123(const char *s, struct tm *t)
 {
+  memset(t, 0, sizeof(*t));
   return check_str_end(strptime(s, "%a, %d %b %Y %H:%M:%S GMT", t));
 }
 
 static bool parse_rfc1123_alt(const char *s, struct tm *t)
 {
+  memset(t, 0, sizeof(*t));
   return check_str_end(strptime(s, "%a, %d %b %Y %H:%M:%S %z", t));
 }