[tin-dev] [tin 2.6.4] snapshots
Urs Janßen
urs at tin.org
Fri Apr 5 04:51:21 CEST 2024
In <mailman.2327.1711643432.1791.tin-dev at tin.org> on Thu, 28 Mar 2024 17:30:31,
Urs Janßen wrote:
> NOT well tested
the last snapshot has two unsightly errors that are really annoying:
- sort may not work on big endian systems where sizeof(long) is not
sizeof(t_artnum) (e.g. 32 bit)
- and even worse: interactive passwords were truncated (~/.newsauth
still worked).
sorry for in the issues
=== modified file 'src/art.c'
--- old/src/art.c 2024-04-01 23:01:11 +0000
+++ new/src/art.c 2024-04-03 14:41:23 +0000
@@ -89,7 +89,7 @@
static t_artnum setup_hard_base(struct t_group *group);
static t_bool parse_headers(FILE *fp, struct t_article *h);
static t_compfunc eval_sort_arts_func(unsigned int sort_art_type);
-static time_t get_last_posting_date(long n);
+static time_t get_last_posting_date(int n);
static void sort_base(unsigned int sort_threads_type);
static void thread_by_multipart(void);
static void thread_by_percentage(unsigned int percentage);
@@ -3164,15 +3164,15 @@
t_comptype p1,
t_comptype p2)
{
- int a = get_score_of_thread((int) *(const long *) p1);
- int b = get_score_of_thread((int) *(const long *) p2);
+ int a = get_score_of_thread((int) *(const t_artnum *) p1);
+ int b = get_score_of_thread((int) *(const t_artnum *) p2);
/* If scores are equal, compare using the article sort order.
* This determines the order in a group of equally scored threads.
*/
if (a == b) {
- t_comptype s1 = &arts[*(const long *) p1];
- t_comptype s2 = &arts[*(const long *) p2];
+ t_comptype s1 = &arts[*(const t_artnum *) p1];
+ t_comptype s2 = &arts[*(const t_artnum *) p2];
t_compfunc comp_func = eval_sort_arts_func(CURR_GROUP.attribute->sort_article_type);
if (comp_func)
@@ -3197,8 +3197,8 @@
t_comptype p1,
t_comptype p2)
{
- time_t s1_last = get_last_posting_date(*(const long *) p1);
- time_t s2_last = get_last_posting_date(*(const long *) p2);
+ time_t s1_last = get_last_posting_date(*(const t_artnum *) p1);
+ time_t s2_last = get_last_posting_date(*(const t_artnum *) p2);
if (s2_last < s1_last)
return -1;
@@ -3215,8 +3215,8 @@
t_comptype p1,
t_comptype p2)
{
- time_t s1_last = get_last_posting_date(*(const long *) p1);
- time_t s2_last = get_last_posting_date(*(const long *) p2);
+ time_t s1_last = get_last_posting_date(*(const t_artnum *) p1);
+ time_t s2_last = get_last_posting_date(*(const t_artnum *) p2);
if (s2_last > s1_last)
return -1;
@@ -3230,9 +3230,9 @@
static time_t
get_last_posting_date(
- long n)
+ int n)
{
- long i;
+ int i;
time_t last = (time_t) 0;
for (i = n; i >= 0; i = arts[i].thread) {
=== modified file 'src/auth.c'
--- old/src/auth.c 2024-03-13 02:55:36 +0000
+++ new/src/auth.c 2024-04-05 02:39:57 +0000
@@ -752,16 +752,16 @@
prompt_for_authid(
char *authuser
) {
- char *authid = my_malloc(128);
+ char *authid;
+ size_t maxlen = 255;
# ifdef USE_CURSES
int state = RawState();
-# endif /* USE_CURSES */
-# ifdef USE_CURSES
Raw(TRUE);
# endif /* USE_CURSES */
- if (!prompt_default_string(_(txt_auth_user), authid, sizeof(authid) - 1, authuser, HIST_NONE)) {
+ authid = my_malloc(maxlen--);
+ if (!prompt_default_string(_(txt_auth_user), authid, maxlen, authuser, HIST_NONE)) {
# ifdef DEBUG
if ((debug & DEBUG_NNTP) && verbose > 1)
debug_print_file("NNTP", "authorization failed: no username");
@@ -786,18 +786,20 @@
prompt_for_password(
void
) {
- char *pass = my_malloc(128);
+ char *pass;
+ size_t maxlen = 255;
# ifdef USE_CURSES
+ pass = my_malloc(maxlen--);
my_printf("%s", _(txt_auth_pass));
- wgetnstr(stdscr, pass, sizeof(pass) - 1);
- pass[sizeof(pass) - 1] = '\0';
+ wgetnstr(stdscr, pass, maxlen);
+ pass[maxlen] = '\0';
# else
/*
* on some systems (i.e. Solaris) getpass(3) is limited
* to 8 chars -> we use tin_getline()
*/
- STRCPY(pass, tin_getline(_(txt_auth_pass), 0, NULL, sizeof(pass) - 1, TRUE, HIST_NONE));
+ pass = my_strdup(tin_getline(_(txt_auth_pass), 0, NULL, maxlen, TRUE, HIST_NONE));
# endif /* USE_CURSES */
return pass;
More information about the tin-dev
mailing list