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

Diff of /lbbs/src/menu.c

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

Revision 1.26 by sysadm, Mon May 5 02:54:27 2025 UTC Revision 1.28 by sysadm, Mon May 5 11:46:04 2025 UTC
# Line 50  int load_menu(MENU_SET *p_menu_set, cons Line 50  int load_menu(MENU_SET *p_menu_set, cons
50                  return -1;                  return -1;
51          }          }
52    
53          strcpy(p_menu_set->conf_file, conf_file);          strncpy(p_menu_set->conf_file, conf_file, sizeof(p_menu_set->conf_file) - 1);
54            p_menu_set->conf_file[sizeof(p_menu_set->conf_file) - 1] = '\0';
55    
56          while (fgets(buffer, sizeof(buffer), fin))          while (fgets(buffer, sizeof(buffer), fin))
57          {          {
# Line 64  int load_menu(MENU_SET *p_menu_set, cons Line 65  int load_menu(MENU_SET *p_menu_set, cons
65                                  strncpy(temp, buffer + pmatch[1].rm_so,                                  strncpy(temp, buffer + pmatch[1].rm_so,
66                                                  pmatch[1].rm_eo - pmatch[1].rm_so);                                                  pmatch[1].rm_eo - pmatch[1].rm_so);
67                                  temp[pmatch[1].rm_eo - pmatch[1].rm_so] = '\0';                                  temp[pmatch[1].rm_eo - pmatch[1].rm_so] = '\0';
68                                  sprintf(screen_filename, "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);                                  snprintf(screen_filename, sizeof(screen_filename), "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);
69    
70                                  if ((fout = fopen(screen_filename, "w")) == NULL)                                  if ((fout = fopen(screen_filename, "w")) == NULL)
71                                  {                                  {
# Line 249  int load_menu(MENU_SET *p_menu_set, cons Line 250  int load_menu(MENU_SET *p_menu_set, cons
250                                                                  buffer + pmatch[3].rm_so,                                                                  buffer + pmatch[3].rm_so,
251                                                                  pmatch[3].rm_eo - pmatch[3].rm_so);                                                                  pmatch[3].rm_eo - pmatch[3].rm_so);
252                                                  temp[pmatch[3].rm_eo - pmatch[3].rm_so] = '\0';                                                  temp[pmatch[3].rm_eo - pmatch[3].rm_so] = '\0';
253                                                  sprintf(p_menu_set->p_menu[i]->screen.filename,                                                  snprintf(p_menu_set->p_menu[i]->screen.filename,
254                                                                  "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);                                                                   sizeof(p_menu_set->p_menu[i]->screen.filename),
255                                                                     "%s/MENU_SCR_%s", MENU_TEMP_DIR, temp);
256                                                  continue;                                                  continue;
257                                          }                                          }
258                                  }                                  }
# Line 514  int reload_menu(MENU_SET *p_menu_set) Line 516  int reload_menu(MENU_SET *p_menu_set)
516          int result;          int result;
517          char conf_file[FILE_PATH_LEN];          char conf_file[FILE_PATH_LEN];
518    
519          strncpy(conf_file, p_menu_set->conf_file, sizeof(conf_file));          strncpy(conf_file, p_menu_set->conf_file, sizeof(conf_file) - 1);
520            conf_file[sizeof(conf_file) - 1] = '\0';
521    
522          unload_menu(p_menu_set);          unload_menu(p_menu_set);
523          result = load_menu(p_menu_set, conf_file);          result = load_menu(p_menu_set, conf_file);
524    


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

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