/[LeafOK_CVS]/lbbs/src/user_info_display.c
ViewVC logotype

Diff of /lbbs/src/user_info_display.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.7 by sysadm, Thu Oct 23 13:12:03 2025 UTC Revision 1.9 by sysadm, Thu Oct 23 13:41:47 2025 UTC
# Line 42  const char *get_astro_name(time_t birthd Line 42  const char *get_astro_name(time_t birthd
42    
43          localtime_r(&birthday, &tm_birth);          localtime_r(&birthday, &tm_birth);
44    
45          if (tm_birth.tm_mon < 1 || tm_birth.tm_mon > 12 || tm_birth.tm_mday < 1 || tm_birth.tm_mday > 31)          if (tm_birth.tm_mday < astro_dates[tm_birth.tm_mon])
46          {          {
47                  return astro_names[0];                  return astro_names[tm_birth.tm_mon];
48          }          }
49    
50          if (tm_birth.tm_mday < astro_dates[tm_birth.tm_mon - 1])          return astro_names[tm_birth.tm_mon + 1];
         {  
                 return astro_names[tm_birth.tm_mon - 1];  
         }  
   
         return astro_names[tm_birth.tm_mon];  
51  }  }
52    
53  static const int user_level_points[] = {  static const int user_level_points[] = {
# Line 144  int user_info_display(USER_INFO *p_user_ Line 139  int user_info_display(USER_INFO *p_user_
139          char str_last_logout_dt[LAST_LOGIN_DT_MAX_LEN + 1];          char str_last_logout_dt[LAST_LOGIN_DT_MAX_LEN + 1];
140          char login_ip[IP_ADDR_LEN];          char login_ip[IP_ADDR_LEN];
141          int ip_mask_level;          int ip_mask_level;
142            const char *p_action_title;
143          char action_str[LINE_BUFFER_LEN];          char action_str[LINE_BUFFER_LEN];
144          const char *user_level_name;          const char *user_level_name;
145          char intro_f[BBS_user_intro_max_len];          char intro_f[BBS_user_intro_max_len];
# Line 204  int user_info_display(USER_INFO *p_user_ Line 200  int user_info_display(USER_INFO *p_user_
200          p = action_str;          p = action_str;
201          for (i = 0; i < session_cnt; i++)          for (i = 0; i < session_cnt; i++)
202          {          {
203                  if (p + strlen(sessions[i].current_action_title) + 4 >= action_str + sizeof(action_str)) // buffer overflow                  p_action_title = (sessions[i].current_action_title != NULL
204                                                              ? sessions[i].current_action_title
205                                                              : sessions[i].current_action);
206    
207                    if (p + strlen(p_action_title) + 4 >= action_str + sizeof(action_str)) // buffer overflow
208                  {                  {
209                          log_error("action_str of user(uid=%d) truncated at i=%d\n", p_user_info->uid, i);                          log_error("action_str of user(uid=%d) truncated at i=%d\n", p_user_info->uid, i);
210                          break;                          break;
211                  }                  }
212                  *p++ = '[';                  *p++ = '[';
213                  for (q = sessions[i].current_action_title; *q != '\0';)                  for (q = p_action_title; *q != '\0';)
214                  {                  {
215                          *p++ = *q++;                          *p++ = *q++;
216                  }                  }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1