Changeset 76 for trunk/src/trustfile.c
- Timestamp:
- Dec 19, 2006, 10:01:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/trustfile.c
r1 r76 687 687 if (retry_lstat(FIL__, __LINE__, fexp, &stbuf) < 0) 688 688 { 689 (void) strcpy(tf_path, fexp); /* known to fit */ 689 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 690 tf_path[sizeof(tf_path)-1] = '\0'; 690 691 #ifdef TRUST_MAIN 691 692 fprintf(stderr, "---------------------------------------------\n"); 692 fprintf(stderr, "trustfile: ESTAT: stat(%s) failed, maybe the file does not exist\n",693 fexp);693 fprintf(stderr, "trustfile: ESTAT: stat(%s) failed,\n", fexp); 694 fprintf(stderr, "maybe the file does not exist\n"); 694 695 fprintf(stderr, "---------------------------------------------\n"); 695 696 #endif … … 781 782 /* yes -- error 782 783 */ 783 (void) strcpy(tf_path, fexp); /* known to fit */ 784 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 785 tf_path[sizeof(tf_path)-1] = '\0'; 784 786 #ifdef TRUST_MAIN 785 787 fprintf(stderr, "---------------------------------------------\n"); … … 850 852 fprintf(stderr, "---------------------------------------------\n"); 851 853 #endif 852 (void) strcpy(tf_path, fexp); /* known to fit */ 854 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 855 tf_path[sizeof(tf_path)-1] = '\0'; 856 853 857 tf_baduid = (uid_t) stbuf.st_uid; 854 858 SL_IRETURN(SL_EBADUID, _("sl_trustfile")); … … 887 891 fprintf(stderr, "---------------------------------------------\n"); 888 892 #endif 889 (void) strcpy(tf_path, fexp); /* known to fit */ 893 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 894 tf_path[sizeof(tf_path)-1] = '\0'; 895 890 896 tf_badgid = (gid_t) stbuf.st_gid; 891 897 SL_IRETURN(SL_EBADGID, _("sl_trustfile")); … … 909 915 fprintf(stderr, "---------------------------------------------\n"); 910 916 #endif 911 (void) strcpy(tf_path, fexp); /* known to fit */ 917 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 918 tf_path[sizeof(tf_path)-1] = '\0'; 919 912 920 SL_IRETURN(SL_EBADOTH, _("sl_trustfile")); 913 921 } … … 932 940 * yes, it can be trusted 933 941 */ 934 (void) strcpy(tf_path, fexp); /* known to fit */ 942 (void) strncpy(tf_path, fexp, sizeof(tf_path)); 943 tf_path[sizeof(tf_path)-1] = '\0'; 944 935 945 SL_IRETURN(SL_ENONE, _("sl_trustfile")); 936 946 }
Note:
See TracChangeset
for help on using the changeset viewer.