comparison libpurple/util.c @ 21611:87387eac4348

Fix a bug in purple_str_to_time() that could cause it to try reading past the end of the input string
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 22 Nov 2007 16:32:56 +0000
parents 07588cb48434
children 18fb032a602a
comparison
equal deleted inserted replaced
21610:0e4549c09e64 21611:87387eac4348
815 int tzhrs; 815 int tzhrs;
816 int tzmins; 816 int tzmins;
817 817
818 t->tm_isdst = -1; 818 t->tm_isdst = -1;
819 819
820 if (*c == '.' && *(c+1) >= '0' && *(c+1) <= '9') /* dealing with precision we don't care about */ 820 if (*c == '.') {
821 c += 4; 821 do {
822 c++;
823 } while (*c >= '0' && *c <= '9'); /* dealing with precision we don't care about */
824 }
822 if (*c == '+') 825 if (*c == '+')
823 offset_positive = TRUE; 826 offset_positive = TRUE;
824 if (((*c == '+' || *c == '-') && (c = c + 1)) && 827 if (((*c == '+' || *c == '-') && (c = c + 1)) &&
825 ((sscanf(c, "%02d:%02d", &tzhrs, &tzmins) == 2 && (c = c + 5)) || 828 ((sscanf(c, "%02d:%02d", &tzhrs, &tzmins) == 2 && (c = c + 5)) ||
826 (sscanf(c, "%02d%02d", &tzhrs, &tzmins) == 2 && (c = c + 4)))) 829 (sscanf(c, "%02d%02d", &tzhrs, &tzmins) == 2 && (c = c + 4))))