소스 검색

Fixed small buffer in get_datetime()

The buffer being hardcoded to 19 (the size expected from the default time format),
strftime() would fail on any format returning a longer buffer.
Changed it from 19 to 64 to accomodate longer formats.
master
Vincent Loupmon 8 년 전
부모
커밋
790e150a1c
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. +2
    -2
      slstatus.c

+ 2
- 2
slstatus.c 파일 보기

@@ -143,13 +143,13 @@ char *
get_datetime()
{
time_t tm;
size_t bufsize = 19;
size_t bufsize = 64;
char *buf = malloc(bufsize);

/* get time in format */
time(&tm);
if(!strftime(buf, bufsize, timeformat, localtime(&tm))) {
fprintf(stderr, "Strftime failed.\n");
fprintf(stderr, "Strftime failed.\n");
exit(1);
}



불러오는 중...
취소
저장