From 9b8b295853c50ac4b758b7d8ba1540dd4349066e Mon Sep 17 00:00:00 2001 From: Ubuntu Developers Date: Sat, 14 May 2022 02:57:07 +0800 Subject: [PATCH] workaround-gcc-lintian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # DP: lintian finds “characte” in the source and tags it as a # DP: spelling mistake, but it’s an artefact of GCC inlining # DP: the strcpy call below; unify the way how err is produced # DP: and use a secure string function while at it # DP: lintian finds “characte” in the source and tags it as a # DP: spelling mistake, but it’s an artefact of GCC inlining # DP: the strcpy call below; unify the way how err is produced # DP: and use a secure string function while at it Gbp-Pq: Name 0005-workaround-gcc-lintian.patch --- src/init.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/init.c b/src/init.c index 767d1ce..e12f083 100644 --- a/src/init.c +++ b/src/init.c @@ -1507,12 +1507,17 @@ void read_inittab(void) if (!action || !*action) strcpy(err, "missing action field"); if (id && strlen(id) > sizeof(utproto.ut_id)) - sprintf(err, "id field too long (max %d characters)", - (int)sizeof(utproto.ut_id)); + snprintf(err, sizeof(err), + "%s field too long (max %d characters)", + "id", (int)sizeof(utproto.ut_id)); if (rlevel && strlen(rlevel) > 11) - strcpy(err, "rlevel field too long (max 11 characters)"); + snprintf(err, sizeof(err), + "%s field too long (max %d characters)", + "rlevel", 11); if (process && strlen(process) > 127) - strcpy(err, "process field too long (max 127 characters)"); + snprintf(err, sizeof(err), + "%s field too long (max %d characters)", + "process", 127); if (action && strlen(action) > 32) strcpy(err, "action field too long"); if (err[0] != 0) {