소스 검색

strptime: fix use of uninitialized dest field in converting integer

Rich Felker 13 년 전
부모
커밋
5989dde345
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/time/strptime.c

+ 1 - 1
src/time/strptime.c

@@ -155,7 +155,7 @@ char *strptime(const char *s, const char *f, struct tm *tm)
 			if (*s == '+') s++;
 			else if (*s == '-') neg=1, s++;
 			if (!isdigit(*s)) return 0;
-			for (i=0; i<w && isdigit(*s); i++)
+			for (*dest=i=0; i<w && isdigit(*s); i++)
 				*dest = *dest * 10 + *s++ - '0';
 			if (neg) *dest = -*dest;
 			*dest -= adj;