Commit e3199de8d492801af7a1268d0bd0e8339074a9cd

Stefan Sperling 2021-03-21T19:09:35

fix strftime return value check; found by jrick

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/got/got.c b/got/got.c
index 72b046e..28c535e 100644
--- a/got/got.c
+++ b/got/got.c
@@ -7785,8 +7785,7 @@ get_commit_brief_str(char **brief_str, struct got_commit_object *commit)
 	committer_time = got_object_commit_get_committer_time(commit);
 	if (localtime_r(&committer_time, &tm) == NULL)
 		return got_error_from_errno("localtime_r");
-	if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d", &tm)
-	    >= sizeof(datebuf))
+	if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d", &tm) == 0)
 		return got_error(GOT_ERR_NO_SPACE);
 
 	author0 = strdup(got_object_commit_get_author(commit));