Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From 68d6969f3f7b03fbd308a87cfa50f4ffba48dad5 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sat, 6 Mar 2021 19:11:15 +0000
>Subject: [PATCH] more.c: some changes

  Use 8bit data, change "data_bits" from 7 to 8.

  Add a declaration for "ndelayed_msg", that is the size of array
"delayed_msg[]".

  Use "snprintf()" instead of "sprintf()".

  Correct the value for "attr" from "NULL_FCT" to "NULL_FCT_INT".

  Add a constant "NPR_FMT" for the number of elements in "pr_fmt[]".

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 more.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/more.c b/more.c
index 0cebb20..08ce974 100644
--- a/more.c
+++ b/more.c
@@ -49,7 +49,7 @@ char           *header_lines = NULL;
 
 int             min_pv_window = 7;
 int             wrap_headers = 6;
-int             data_bits = 7;
+int             data_bits = 8;
 int             scroll_clear_page = 1;
 int             expired_msg_delay = 1;
 char           *trusted_escapes = NULL;
@@ -74,6 +74,7 @@ extern int      mouse_state;
 extern int      alt_cmd_key, in_menu_mode, any_message;
 extern long     n_selected;
 
+extern const size_t ndelayed_msg; /* size of array "delayed_msg[]" */
 extern char     delayed_msg[];
 
 static int      rot13_must_init = 1;
@@ -157,7 +158,7 @@ get_header_field(char code, char **namep, char **valp, 
register article_header *
            /* FALLTHROUGH */
        case 'G':
            if (ah->a_number > 0) {
-               sprintf(special, "%s/%ld",
+               snprintf(special, FILENAME, "%s/%ld",
                        current_group->group_name, (long) ah->a_number);
                lp = special;
            } else
@@ -182,7 +183,7 @@ get_header_field(char code, char **namep, char **valp, 
register article_header *
            break;
 
        case 'i':
-           sprintf(special, "#%ld fl=%ld re=%d li=%d hp=%ld fp=%ld lp=%ld 
ts=%ld",
+           snprintf(special, FILENAME, "#%ld fl=%ld re=%d li=%d hp=%ld fp=%ld 
lp=%ld ts=%ld",
                    (long) ah->a_number, (long) ah->flag, (int) ah->replies,
                    ah->lines, ah->hpos, ah->fpos, (long) ah->lpos,
                    (long) ah->t_stamp);
@@ -213,7 +214,7 @@ next_header_field(char **namep, char **valp, fct_type_int * 
attrp)
     fct_type_int        attr;
 
     while (*scan_codes) {
-       attr = NULL_FCT;
+       attr = NULL_FCT_INT;
        *namep = NULL;
 
        switch (*scan_codes) {
@@ -388,6 +389,8 @@ more(article_header * ah, int mode, int screen_offset)
     flag_type       in_digest = ah->flag & A_DIGEST;
     article_header  digestah;
     char           *fname, *hdrline;
+#define    NPR_FMT  200
+    char            pr_fmt[NPR_FMT], send_date[40];
     char            pr_fmt[200], send_date[40];
     int             match_expr, shade_overlap, shade_line;
     int            *key_map;
@@ -511,7 +514,7 @@ more(article_header * ah, int mode, int screen_offset)
                group_name += len - maxl;
        }
        if (mode & (MM_PREVIEW | MM_DIGEST) || n_selected == 0)
-           sprintf(pr_fmt,
+           snprintf(pr_fmt, NPR_FMT,
                    "\1\2--%s-- %s%s %s--%%s--%%s\1",
                    group_name,
                    (mode & MM_DIGEST) ? "DIGEST" :
@@ -519,14 +522,14 @@ more(article_header * ah, int mode, int screen_offset)
                    (ah->flag & A_NEXT_SAME) ? "+next" : "",
                    novice ? "--help:?" : "");
        else
-           sprintf(pr_fmt,
+           snprintf(pr_fmt, NPR_FMT,
                    "\1\2--%s-- %ld MORE%s %s--%%s--%%s\1",
                    group_name,
                    n_selected,
                    (ah->flag & A_NEXT_SAME) ? "+next" : "",
                    novice ? "--help:?" : "");
     } else
-       sprintf(pr_fmt,
+       snprintf(pr_fmt, NPR_FMT,
                "\1\2-- %s%s %s-----%%s%s-----%%s\1",
                (mode & MM_PREVIEW) ? "PREVIEW " : "",
                (mode & MM_DIGEST) ? "FULL DIGEST" :
-- 
2.30.1



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to