git: 5dbd073b045c - main - awk: errror on printf format strings lacking conversion specifier

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 14 Apr 2023 17:31:51 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dbd073b045c8e98730c025a4acf2279be26c33e

commit 5dbd073b045c8e98730c025a4acf2279be26c33e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-04-14 14:49:05 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-04-14 17:31:02 +0000

    awk: errror on printf format strings lacking conversion specifier
    
    Reported by:    phk
    Reviewed by:    imp, markj
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D39573
---
 contrib/one-true-awk/run.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c
index 117fb0748bd8..b81dafba35e6 100644
--- a/contrib/one-true-awk/run.c
+++ b/contrib/one-true-awk/run.c
@@ -912,6 +912,9 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a)	/* printf-like co
 		case 'c':
 			flag = 'c';
 			break;
+		case '\0':
+			FATAL("missing printf conversion specifier");
+			break;
 		default:
 			WARNING("weird printf conversion %s", fmt);
 			flag = '?';