- Timestamp:
- Nov 19, 2020, 2:17:57 AM (4 years ago)
- Location:
- branches/3.3/mondo
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-archive.c
r3746 r3777 487 487 ntapedev = get_non_rewind_dev(bkpinfo->media_device); 488 488 if ((bkpinfo->use_obdr) && (ntapedev != NULL)) { 489 strncpy(bkpinfo->media_device,ntapedev,(size_t)( MAX_STR_LEN / 4));489 strncpy(bkpinfo->media_device,ntapedev,(size_t)((MAX_STR_LEN / 4)-1)); 490 490 } else { 491 491 if (ntapedev == NULL) { -
branches/3.3/mondo/src/common/libmondo-cli.c
r3658 r3777 466 466 tmp2 = call_program_and_get_last_line_of_output(tmp1); 467 467 mr_free(tmp1); 468 strncpy(bkpinfo->isodir, tmp2, MAX_STR_LEN / 4);468 strncpy(bkpinfo->isodir, tmp2, (MAX_STR_LEN / 4)-1); 469 469 mr_free(tmp2); 470 470 … … 514 514 } 515 515 tmp2 = call_program_and_get_last_line_of_output(tmp1); 516 strncpy(bkpinfo->isodir, tmp2, MAX_STR_LEN / 4);516 strncpy(bkpinfo->isodir, tmp2,(MAX_STR_LEN / 4)-1); 517 517 mr_free(tmp2); 518 518 if (strlen(bkpinfo->isodir) < 3) { … … 661 661 662 662 if (flag_set['x']) { 663 strncpy(bkpinfo->image_devs, flag_val['x'], MAX_STR_LEN / 4);663 strncpy(bkpinfo->image_devs, flag_val['x'],(MAX_STR_LEN / 4)-1); 664 664 if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) { 665 665 fatal_error("Please install ntfsprogs package/tarball."); … … 680 680 681 681 if (flag_set['p']) { 682 strncpy(bkpinfo->prefix, flag_val['p'], MAX_STR_LEN / 4);682 strncpy(bkpinfo->prefix, flag_val['p'],(MAX_STR_LEN / 4)-1); 683 683 log_msg(1,"Prefix forced to %s",bkpinfo->prefix); 684 684 } … … 686 686 if (flag_set['d']) { /* backup directory (if ISO/NETFS) */ 687 687 if (flag_set['i']) { 688 strncpy(bkpinfo->isodir, flag_val['d'], MAX_STR_LEN / 4);688 strncpy(bkpinfo->isodir, flag_val['d'],(MAX_STR_LEN / 4)-1); 689 689 sprintf(tmp, "ls -l %s", bkpinfo->isodir); 690 690 if (run_program_and_log_output(tmp, 2)) { … … 695 695 mr_asprintf(bkpinfo->netfs_remote_dir, "%s", flag_val['d']); 696 696 } else { /* backup device (if tape/CD-R/CD-RW) */ 697 strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4);697 strncpy(bkpinfo->media_device, flag_val['d'],(MAX_STR_LEN / 4)-1); 698 698 } 699 699 } -
branches/3.3/mondo/src/common/libmondo-devices.c
r3755 r3777 492 492 493 493 if (!dev[0] || (res = mount_CDROM_here(dev, mountpoint))) { 494 if (!popup_and_get_string("CD-ROM device", "Please enter your CD-ROM's /dev device", dev, MAX_STR_LEN / 4)) {494 if (!popup_and_get_string("CD-ROM device", "Please enter your CD-ROM's /dev device", dev,(MAX_STR_LEN / 4)-1)) { 495 495 res = 1; 496 496 } else { … … 2308 2308 log_msg(1, "bkpinfo->media_device = %s", bkpinfo->media_device); 2309 2309 mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds); 2310 if (!popup_and_get_string("Device?", comment, bkpinfo->media_device, MAX_STR_LEN / 4)) {2310 if (!popup_and_get_string("Device?", comment, bkpinfo->media_device,(MAX_STR_LEN / 4)-1)) { 2311 2311 log_to_screen("User has chosen not to backup the machine"); 2312 2312 finish(1); … … 2331 2331 if (!bkpinfo->media_device[0]) { 2332 2332 if (bkpinfo->backup_media_type == usb) { 2333 i = popup_and_get_string("/dev entry?", "What is the /dev entry of your USB Disk/Key, please?", bkpinfo->media_device, MAX_STR_LEN / 4);2333 i = popup_and_get_string("/dev entry?", "What is the /dev entry of your USB Disk/Key, please?", bkpinfo->media_device, (MAX_STR_LEN / 4)-1); 2334 2334 } else { 2335 2335 if (g_kernel_version < 2.6) { 2336 i = popup_and_get_string("Device node?", "What is the SCSI node of your CD (re)writer, please?", bkpinfo->media_device, MAX_STR_LEN / 4);2336 i = popup_and_get_string("Device node?", "What is the SCSI node of your CD (re)writer, please?", bkpinfo->media_device,(MAX_STR_LEN / 4)-1); 2337 2337 } else { 2338 i = popup_and_get_string("/dev entry?", "What is the /dev entry of your CD (re)writer, please?", bkpinfo->media_device, MAX_STR_LEN / 4);2338 i = popup_and_get_string("/dev entry?", "What is the /dev entry of your CD (re)writer, please?", bkpinfo->media_device,(MAX_STR_LEN / 4)-1); 2339 2339 } 2340 2340 } … … 2385 2385 } 2386 2386 if (!bkpinfo->media_device[0]) { 2387 if (!popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device, MAX_STR_LEN / 4)) {2387 if (!popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device,(MAX_STR_LEN / 4)-1)) { 2388 2388 log_to_screen("User has chosen not to backup the machine"); 2389 2389 finish(1); … … 2457 2457 #endif 2458 2458 { 2459 if (!popup_and_get_string("Network shared dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", p, MAX_STR_LEN / 4)) {2459 if (!popup_and_get_string("Network shared dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", p,(MAX_STR_LEN / 4)-1)) { 2460 2460 log_to_screen("User has chosen not to backup the machine"); 2461 2461 finish(1); … … 2523 2523 } 2524 2524 strcpy(tmp1, bkpinfo->netfs_proto); 2525 if (!popup_and_get_string("Network protocol", "Which protocol should I use (nfs/sshfs/smbfs) ?",tmp1, MAX_STR_LEN )) {2525 if (!popup_and_get_string("Network protocol", "Which protocol should I use (nfs/sshfs/smbfs) ?",tmp1, MAX_STR_LEN-1)) { 2526 2526 log_to_screen("User has chosen not to backup the machine"); 2527 2527 finish(1); … … 2531 2531 2532 2532 strcpy(tmp1, bkpinfo->netfs_mount); 2533 if (!popup_and_get_string("Network share", "Which remote share should I mount?", tmp1, MAX_STR_LEN )) {2533 if (!popup_and_get_string("Network share", "Which remote share should I mount?", tmp1, MAX_STR_LEN-1)) { 2534 2534 log_to_screen("User has chosen not to backup the machine"); 2535 2535 finish(1); … … 2543 2543 strcpy(tmp1, ""); 2544 2544 } 2545 if (!popup_and_get_string("Network user", "Which user should I use if any ?",tmp1, MAX_STR_LEN )) {2545 if (!popup_and_get_string("Network user", "Which user should I use if any ?",tmp1, MAX_STR_LEN-1)) { 2546 2546 log_to_screen("User has chosen not to backup the machine"); 2547 2547 finish(1); … … 2560 2560 } else { 2561 2561 // Why netfsdir ? 2562 s printf(bkpinfo->isodir, "%s/netfsdir", bkpinfo->tmpdir);2562 snprintf(bkpinfo->isodir, (MAX_STR_LEN / 4) -1, "%s/netfsdir", bkpinfo->tmpdir); 2563 2563 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 2564 2564 run_program_and_log_output(command, 5); … … 2606 2606 } 2607 2607 strcpy(tmp1, bkpinfo->netfs_remote_dir); 2608 if (!popup_and_get_string ("Directory", "Which directory within that mountpoint?", tmp1, MAX_STR_LEN )) {2608 if (!popup_and_get_string ("Directory", "Which directory within that mountpoint?", tmp1, MAX_STR_LEN-1)) { 2609 2609 log_to_screen("User has chosen not to backup the machine"); 2610 2610 finish(1); … … 2614 2614 bkpinfo->netfs_remote_dir = mr_strip_spaces(tmp1); 2615 2615 2616 if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename. Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix, MAX_STR_LEN / 4)) {2616 if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename. Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix,(MAX_STR_LEN / 4)-1)) { 2617 2617 log_to_screen("User has chosen not to backup the machine"); 2618 2618 finish(1); … … 2625 2625 case iso: 2626 2626 if (!bkpinfo->disaster_recovery) { 2627 if (!popup_and_get_string("Storage dir.", "Please enter the full path name to the directory for your ISO images. Example: /mnt/raid0_0", bkpinfo->isodir, MAX_STR_LEN / 4)) {2627 if (!popup_and_get_string("Storage dir.", "Please enter the full path name to the directory for your ISO images. Example: /mnt/raid0_0", bkpinfo->isodir,(MAX_STR_LEN / 4)-1)) { 2628 2628 log_to_screen("User has chosen not to backup the machine"); 2629 2629 finish(1); … … 2648 2648 } 2649 2649 } 2650 if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename. Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix, MAX_STR_LEN / 4)) {2650 if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename. Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix,(MAX_STR_LEN / 4)-1)) { 2651 2651 log_to_screen("User has chosen not to backup the machine"); 2652 2652 finish(1); … … 2672 2672 2673 2673 #ifdef __FreeBSD__ 2674 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device, MAX_STR_LEN / 4)) {2674 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device,(MAX_STR_LEN / 4)-1)) { 2675 2675 log_to_screen("User has chosen not to backup the machine"); 2676 2676 finish(1); … … 2679 2679 #else 2680 2680 strcpy(tmp1, bkpinfo->boot_device); 2681 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", tmp1, MAX_STR_LEN / 4)) {2681 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", tmp1,(MAX_STR_LEN / 4)-1)) { 2682 2682 log_to_screen("User has chosen not to backup the machine"); 2683 2683 finish(1); … … 2716 2716 strcpy(tmp1, "/"); 2717 2717 } 2718 if (!popup_and_get_string("Backup paths", "Please enter paths (separated by '|') which you want me to backup. The default is '/' (i.e. everything).", tmp1, MAX_STR_LEN )) {2718 if (!popup_and_get_string("Backup paths", "Please enter paths (separated by '|') which you want me to backup. The default is '/' (i.e. everything).", tmp1, MAX_STR_LEN-1)) { 2719 2719 log_to_screen("User has chosen not to backup the machine"); 2720 2720 finish(1); … … 2729 2729 // NTFS 2730 2730 tmp = call_program_and_get_last_line_of_output("mr-parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"); 2731 strncpy(tmp1, tmp, MAX_STR_LEN / 4);2731 strncpy(tmp1, tmp,(MAX_STR_LEN / 4)-1); 2732 2732 mr_free(tmp); 2733 2733 if (strlen(tmp1) > 2) { 2734 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) {2734 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1,(MAX_STR_LEN / 4)-1)) { 2735 2735 log_to_screen("User has chosen not to backup the machine"); 2736 2736 finish(1); 2737 2737 } 2738 strncpy(bkpinfo->image_devs, tmp1, MAX_STR_LEN / 4);2738 strncpy(bkpinfo->image_devs, tmp1, (MAX_STR_LEN / 4)-1); 2739 2739 } 2740 2740 … … 2755 2755 mr_asprintf(oldtmp, "%s", bkpinfo->tmpdir); 2756 2756 if (bkpinfo->tmpdir != NULL ) { 2757 strncpy(p,bkpinfo->tmpdir,( 16*MAX_STR_LEN)-1);2757 strncpy(p,bkpinfo->tmpdir,(MAX_STR_LEN / 4)-1); 2758 2758 } else { 2759 2759 p[0] = '\0'; … … 2771 2771 mr_asprintf(oldtmp, "%s", bkpinfo->scratchdir); 2772 2772 if (bkpinfo->scratchdir != NULL ) { 2773 strncpy(p,bkpinfo->scratchdir,( 16*MAX_STR_LEN)-1);2773 strncpy(p,bkpinfo->scratchdir,(MAX_STR_LEN / 4)-1); 2774 2774 } else { 2775 2775 p[0] = '\0'; -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3753 r3777 927 927 read_cfg_var(cfg_file, "iso-mnt", iso_mnt); 928 928 read_cfg_var(cfg_file, "iso-dir", iso_path); 929 s printf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);929 snprintf(bkpinfo->isodir, (MAX_STR_LEN / 4)-1, "%s%s", iso_mnt, iso_path); 930 930 if (!bkpinfo->isodir[0]) { 931 931 strcpy(bkpinfo->isodir, old_isodir); -
branches/3.3/mondo/test/test-mountlist.c
r3566 r3777 39 39 40 40 char *g_mountlist_fname; 41 char *g_mondo_home;41 //char *g_mondo_home; 42 42 43 char *g_getfacl;44 char *g_getfattr;43 //char *g_getfacl; 44 //char *g_getfattr; 45 45 46 46 extern char *MONDO_LOGFILE; -
branches/3.3/mondo/test/test-truncname.c
r3374 r3777 33 33 34 34 char *g_mountlist_fname; 35 char *g_mondo_home;35 //char *g_mondo_home; 36 36 37 37 char *g_getfacl;
Note:
See TracChangeset
for help on using the changeset viewer.