Hard to hit. Nevertheless it seems better to error out than to
crash in strcmp()
Index: seq.c
===
RCS file: /cvs/src/usr.bin/seq/seq.c,v
retrieving revision 1.3
diff -u -p -r1.3 seq.c
--- seq.c 22 Feb 2022 16:14:38 - 1.3
+++ seq.c 22 Feb 2022 16:23:08 -
@@ -195,8 +195,9 @@ main(int argc, char *argv[])
* loop held true due to a rounding error and we still need to print
* 'last'.
*/
- asprintf(_print, fmt, cur);
- asprintf(_print, fmt, last);
+ if (asprintf(_print, fmt, cur) == -1 ||
+ asprintf(_print, fmt, last) == -1)
+ err(1, "asprintf");
if (strcmp(cur_print, last_print) == 0 && cur != last_shown_value) {
if (cur != first)
fputs(sep, stdout);