Changeset 22 for trunk/src/sh_utils.c
- Timestamp:
- Feb 23, 2006, 12:03:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_utils.c
r20 r22 189 189 } 190 190 191 int sh_util_hidesetup(c har * c)191 int sh_util_hidesetup(const char * c) 192 192 { 193 193 int i; … … 646 646 static int sigtype = TYPE_HMAC; 647 647 648 int sh_util_sigtype (c har * c)648 int sh_util_sigtype (const char * c) 649 649 { 650 650 SL_ENTER(_("sh_util_sigtype")); … … 957 957 char * key; 958 958 char * path; 959 char * outpath ;959 char * outpath = NULL; 960 960 unsigned char * image = NULL; 961 961 long s = 0; … … 963 963 long ii, k = 0; 964 964 UINT32 * h1; 965 char * new ;965 char * new = NULL; 966 966 967 967 if (0 != sl_is_suid()) … … 999 999 fprintf(stderr, 1000 1000 _("ERROR: no path to executable given\n Argument must be 'key@path'\n")); 1001 free(new); 1001 1002 _exit (EXIT_FAILURE); 1002 1003 /*@notreached@*/ … … 1005 1006 else 1006 1007 path = &new[j]; 1008 1009 len = strlen(path) + 1 + 4; 1007 1010 /*@-usedef@*/ 1008 if (NULL == (outpath = malloc( strlen(path) + 1 + 4)))1011 if (NULL == (outpath = malloc(len))) 1009 1012 goto bail_mem; 1010 1013 /*@-usedef@*/ 1011 /*@-bufferoverflowhigh@*/ 1012 sprintf (outpath, _("%s.out"), path); /* known to fit */ 1013 /*@+bufferoverflowhigh@*/ 1014 sl_snprintf (outpath, len, _("%s.out"), path); 1014 1015 1015 1016 fp = sl_open_read(path, SL_NOPRIV); … … 1018 1019 fprintf(stderr, 1019 1020 _("ERROR: cannot open %s for read (errnum = %ld)\n"), path, fp); 1021 free(new); free (outpath); 1020 1022 _exit (EXIT_FAILURE); 1021 1023 /*@notreached@*/ … … 1028 1030 fprintf(stderr, 1029 1031 _("ERROR: cannot open %s (errnum = %ld)\n"), outpath, fout); 1032 free(new); free (outpath); 1030 1033 _exit (EXIT_FAILURE); 1031 1034 /*@notreached@*/ … … 1068 1071 (void) sl_close (fout); 1069 1072 printf(_("new file %s written\n"), outpath); 1073 free(new); free (outpath); free(image); 1070 1074 _exit (EXIT_SUCCESS); 1071 1075 /*@notreached@*/ … … 1076 1080 fprintf(stderr, 1077 1081 _("ERROR: old key not found\n")); 1082 free(new); free (outpath); free(image); 1078 1083 _exit (EXIT_FAILURE); 1079 1084 /*@notreached@*/ … … 1084 1089 fprintf(stderr, 1085 1090 _("ERROR: out of memory\n")); 1091 if (new) free(new); 1092 if (outpath) free (outpath); 1093 if (image) free (image); 1086 1094 _exit (EXIT_FAILURE); 1087 1095 /*@notreached@*/ … … 1329 1337 static unsigned char sh_obscure_index[256]; 1330 1338 1331 int sh_util_obscure_ok (c har * str)1339 int sh_util_obscure_ok (const char * str) 1332 1340 { 1333 1341 unsigned long i; 1334 char * endptr = str;1342 char * endptr = NULL; 1335 1343 1336 1344 SL_ENTER(_("sh_util_obscure_ex")); … … 1349 1357 sh_obscure_index[i] = (unsigned char)0; 1350 1358 } 1359 1360 i = strtoul (str, &endptr, 0); 1361 if (i > 255) 1362 { 1363 SL_RETURN(-1, _("sh_util_obscure_ex")); 1364 } 1365 sh_obscure_index[i] = (unsigned char)1; 1366 if (*endptr == ',') 1367 ++endptr; 1351 1368 1352 1369 while (*endptr != '\0') … … 1562 1579 } else if (!isgraph ((int) *p)) { /* not printable */ 1563 1580 /*@-bufferoverflowhigh -formatconst@*/ 1581 /* flawfinder: ignore */ 1564 1582 sprintf(oct, format, '\\', /* known to fit */ 1565 1583 (unsigned char) *p);
Note:
See TracChangeset
for help on using the changeset viewer.