- Timestamp:
- Mar 16, 2007, 10:08:08 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/CuTest.c
r17 r96 62 62 str->size = STRING_MAX; 63 63 str->buffer = (char*) malloc(sizeof(char) * str->size); 64 str->buffer[0] = '\0'; 64 if (str->buffer) 65 str->buffer[0] = '\0'; 66 else 67 { 68 perror("CuStringInit"); 69 _exit (EXIT_FAILURE); 70 } 65 71 } 66 72 … … 71 77 str->size = STRING_MAX; 72 78 str->buffer = (char*) malloc(sizeof(char) * str->size); 73 str->buffer[0] = '\0'; 79 if (str->buffer) 80 str->buffer[0] = '\0'; 81 else 82 { 83 perror("CuStringNew"); 84 _exit (EXIT_FAILURE); 85 } 74 86 return str; 75 87 } -
trunk/src/cutest_sh_tiger0.c
r19 r96 17 17 18 18 skey = (sh_key_t *) malloc (sizeof(sh_key_t)); 19 if (skey == NULL) 19 if (skey != NULL) 20 { 21 skey->mlock_failed = SL_FALSE; 22 skey->rngI = BAD; 23 /* properly initialized later 24 */ 25 skey->rng0[0] = 0x03; skey->rng0[1] = 0x09; skey->rng0[2] = 0x17; 26 skey->rng1[0] = 0x03; skey->rng1[1] = 0x09; skey->rng1[2] = 0x17; 27 skey->rng2[0] = 0x03; skey->rng2[1] = 0x09; skey->rng2[2] = 0x17; 28 29 for (i = 0; i < KEY_BYT; ++i) 30 skey->poolv[i] = '\0'; 31 32 skey->poolc = 0; 33 34 skey->ErrFlag[0] = ErrFlag[0]; 35 ErrFlag[0] = 0; 36 skey->ErrFlag[1] = ErrFlag[1]; 37 ErrFlag[1] = 0; 38 39 dez = &(TcpFlag[POS_TF-1][0]); 40 for (i = 0; i < PW_LEN; ++i) 41 { 42 skey->pw[i] = (char) (*dez); 43 (*dez) = '\0'; 44 ++dez; 45 } 46 47 skey->sh_sockpass[0] = '\0'; 48 skey->sigkey_old[0] = '\0'; 49 skey->sigkey_new[0] = '\0'; 50 skey->mailkey_old[0] = '\0'; 51 skey->mailkey_new[0] = '\0'; 52 skey->crypt[0] = '\0'; 53 skey->session[0] = '\0'; 54 skey->vernam[0] = '\0'; 55 } 56 else 20 57 { 21 58 perror(_("sh_init")); 22 59 _exit (EXIT_FAILURE); 23 60 } 24 25 skey->mlock_failed = SL_FALSE;26 skey->rngI = BAD;27 /* properly initialized later28 */29 skey->rng0[0] = 0x03; skey->rng0[1] = 0x09; skey->rng0[2] = 0x17;30 skey->rng1[0] = 0x03; skey->rng1[1] = 0x09; skey->rng1[2] = 0x17;31 skey->rng2[0] = 0x03; skey->rng2[1] = 0x09; skey->rng2[2] = 0x17;32 33 for (i = 0; i < KEY_BYT; ++i)34 skey->poolv[i] = '\0';35 36 skey->poolc = 0;37 38 skey->ErrFlag[0] = ErrFlag[0];39 ErrFlag[0] = 0;40 skey->ErrFlag[1] = ErrFlag[1];41 ErrFlag[1] = 0;42 43 dez = &(TcpFlag[POS_TF-1][0]);44 for (i = 0; i < PW_LEN; ++i)45 {46 skey->pw[i] = (char) (*dez);47 (*dez) = '\0';48 ++dez;49 }50 51 skey->sh_sockpass[0] = '\0';52 skey->sigkey_old[0] = '\0';53 skey->sigkey_new[0] = '\0';54 skey->mailkey_old[0] = '\0';55 skey->mailkey_new[0] = '\0';56 skey->crypt[0] = '\0';57 skey->session[0] = '\0';58 skey->vernam[0] = '\0';59 61 60 62 } -
trunk/src/kern_head.c
r92 r96 753 753 fprintf(stderr, "\n"); 754 754 fprintf(stderr, "NOTE: kern_head: must run as 'root' "); 755 fprintf(stderr, "(need to read from /dev/kmem)\n");755 fprintf(stderr, "(need to read from kernel)\n"); 756 756 fprintf(stderr, " If you get this message, then proceed "); 757 757 fprintf(stderr, "as follows:\n"); -
trunk/src/samhain.c
r92 r96 545 545 */ 546 546 skey = (sh_key_t *) malloc (sizeof(sh_key_t)); 547 if (skey == NULL) 547 if (skey != NULL) 548 { 549 550 skey->mlock_failed = SL_FALSE; 551 skey->rngI = BAD; 552 /* properly initialized later 553 */ 554 skey->rng0[0] = 0x03; skey->rng0[1] = 0x09; skey->rng0[2] = 0x17; 555 skey->rng1[0] = 0x03; skey->rng1[1] = 0x09; skey->rng1[2] = 0x17; 556 skey->rng2[0] = 0x03; skey->rng2[1] = 0x09; skey->rng2[2] = 0x17; 557 558 for (i = 0; i < KEY_BYT; ++i) 559 skey->poolv[i] = '\0'; 560 561 skey->poolc = 0; 562 563 skey->ErrFlag[0] = ErrFlag[0]; 564 ErrFlag[0] = 0; 565 skey->ErrFlag[1] = ErrFlag[1]; 566 ErrFlag[1] = 0; 567 568 dez = &(TcpFlag[POS_TF-1][0]); 569 for (i = 0; i < PW_LEN; ++i) 570 { 571 skey->pw[i] = (char) (*dez); 572 (*dez) = '\0'; 573 ++dez; 574 } 575 576 skey->sh_sockpass[0] = '\0'; 577 skey->sigkey_old[0] = '\0'; 578 skey->sigkey_new[0] = '\0'; 579 skey->mailkey_old[0] = '\0'; 580 skey->mailkey_new[0] = '\0'; 581 skey->crypt[0] = '\0'; /* flawfinder: ignore *//* ff bug */ 582 skey->session[0] = '\0'; 583 skey->vernam[0] = '\0'; 584 } 585 else 548 586 { 549 587 perror(_("sh_init")); 550 588 _exit (EXIT_FAILURE); 551 589 } 552 553 skey->mlock_failed = SL_FALSE;554 skey->rngI = BAD;555 /* properly initialized later556 */557 skey->rng0[0] = 0x03; skey->rng0[1] = 0x09; skey->rng0[2] = 0x17;558 skey->rng1[0] = 0x03; skey->rng1[1] = 0x09; skey->rng1[2] = 0x17;559 skey->rng2[0] = 0x03; skey->rng2[1] = 0x09; skey->rng2[2] = 0x17;560 561 for (i = 0; i < KEY_BYT; ++i)562 skey->poolv[i] = '\0';563 564 skey->poolc = 0;565 566 skey->ErrFlag[0] = ErrFlag[0];567 ErrFlag[0] = 0;568 skey->ErrFlag[1] = ErrFlag[1];569 ErrFlag[1] = 0;570 571 dez = &(TcpFlag[POS_TF-1][0]);572 for (i = 0; i < PW_LEN; ++i)573 {574 skey->pw[i] = (char) (*dez);575 (*dez) = '\0';576 ++dez;577 }578 579 skey->sh_sockpass[0] = '\0';580 skey->sigkey_old[0] = '\0';581 skey->sigkey_new[0] = '\0';582 skey->mailkey_old[0] = '\0';583 skey->mailkey_new[0] = '\0';584 skey->crypt[0] = '\0'; /* flawfinder: ignore *//* ff bug */585 skey->session[0] = '\0';586 skey->vernam[0] = '\0';587 588 590 589 591 sh_unix_memlock(); … … 923 925 else if (pid == respid) 924 926 { 927 #ifndef USE_UNO 925 928 if (0 != WIFEXITED(status)) 926 929 { … … 930 933 else 931 934 exit (1); 935 #else 936 exit (1); 937 #endif 932 938 } 933 939 ++times; -
trunk/src/samhain_hide.c
r91 r96 51 51 * insmod samhain_hide (for improved safety: 'sync && insmod samhain_hide') 52 52 * 53 * To unload the module 53 * Self-hiding can be switched off by passing the option 54 * 'removeme=0' to the module: 55 * insmod ./samhain_hide.ko removeme=0 56 * 57 * To unload the module (only possible if not hidden): 54 58 * rmmod samhain_hide (for improved safety: 'sync && rmmod samhain_hide') 55 59 * … … 109 113 /* #define PROC_DEBUG */ /* procfs */ 110 114 111 112 115 /***************************************************** 113 116 * … … 201 204 int (*old_getdents)(unsigned int, struct dirent *, unsigned int); 202 205 #ifdef __NR_getdents64 206 #if SH_KERNEL_NUMERIC >= 132628 207 /* 208 * 'asmlinkage' is __required__ to get this to work. 209 */ 210 asmlinkage long (*old_getdents64)(unsigned int, struct linux_dirent64 __user *, unsigned int); 211 #else 203 212 long (*old_getdents64)(unsigned int, struct dirent64 *, unsigned int); 213 #endif 204 214 #endif 205 215 … … 416 426 417 427 #ifdef FILE_DEBUG 418 printk("COPY to kernel \n");428 printk("COPY to kernel: %ld\n", dummy); 419 429 #endif 420 430 … … 513 523 dummy = (unsigned long) copy_to_user(dirp, dirp_new, status); 514 524 #ifdef FILE_DEBUG 515 printk("COPY to user \n");525 printk("COPY to user: %ld\n", dummy); 516 526 #endif 517 527 … … 525 535 } 526 536 527 528 537 /* For 2.4 kernel 529 538 */ 530 539 #ifdef __NR_getdents64 531 long new_getdents64 (unsigned int fd, struct dirent64 *dirp, 532 unsigned int count) 540 541 #if SH_KERNEL_NUMERIC >= 132628 542 /* 543 * 'asmlinkage' is __required__ to get this to work. 544 */ 545 asmlinkage long new_getdents64 (unsigned int fd, struct linux_dirent64 __user *dirp, 546 unsigned int count) 547 #else 548 long new_getdents64 (unsigned int fd, struct dirent64 *dirp, unsigned int count) 549 #endif 533 550 { 534 551 long status = 0; /* Return value from original getdents */ … … 549 566 unsigned long dummy; 550 567 568 #ifdef FILE_DEBUG 569 printk("FD64 %d\n", fd); 570 #endif 571 551 572 lock_kernel(); 552 573 574 #ifdef FILE_DEBUG 575 if (!access_ok(VERIFY_WRITE, dirp, count)) 576 printk("ACCESS64_BAD\n"); 577 else 578 printk("ACCESS64_OK\n"); 579 #endif 580 581 #if SH_KERNEL_NUMERIC >= 132628 553 582 status = (*old_getdents64)(fd, dirp, count); 583 // status = my_real_getdents64(fd, dirp, count); 584 #else 585 status = (*old_getdents64)(fd, dirp, count); 586 #endif 554 587 555 588 #ifdef FILE_DEBUG … … 580 613 581 614 #if defined(__LINUX_DCACHE_H) 615 616 /* 2.6.20 (((2) << 16) + ((6) << 8) + (20)) */ 617 #if SH_KERNEL_NUMERIC >= 132628 618 dir_inode = fd_file->f_path.dentry->d_inode; 619 #else 582 620 dir_inode = fd_file->f_dentry->d_inode; 621 #endif 622 583 623 #else 584 624 dir_inode = fd_file->f_inode; … … 630 670 631 671 #ifdef FILE_DEBUG 632 printk("COPY64 to kernel \n");672 printk("COPY64 to kernel: %ld\n", dummy); 633 673 #endif 634 674 … … 731 771 /* Copy our modified dirp table back to user space. 732 772 */ 773 #ifdef FILE_DEBUG 774 printk("STATUS64 AT END %ld\n", status); 775 #endif 733 776 dummy = (unsigned long) copy_to_user(dirp, dirp_new, status); 777 #ifdef FILE_DEBUG 778 printk("COPY64 to user: %ld\n", dummy); 779 #endif 780 734 781 kfree (dirp_new); 735 782 unlock_kernel(); -
trunk/src/sh_extern.c
r50 r96 541 541 if (task->pid == retval) 542 542 { 543 #ifndef USE_UNO 543 544 if (WIFEXITED(task->exit_status) != 0) 544 545 { … … 572 573 task->exit_status = EXIT_FAILURE; 573 574 } 575 #else 576 task->exit_status = EXIT_FAILURE; 577 #endif 574 578 } 575 579 else if (0 == retval) -
trunk/test/testcompile.sh
r91 r96 53 53 cat $i | ./unreached_code.pl; 54 54 cat $i | ./ampersand_missing.sh; 55 cat $i | ./uninitialized.pl;56 55 cat $i | ./eqeq.pl; 57 cat $i | ./for_bounds.pl; 56 cat $i | ./for_bounds.pl; # doesn't work? 58 57 cat $i | ./unchecked_returns.pl; 59 cat $i | ./un reached_code.pl;60 cat $i | ./uninitialized.pl; 58 cat $i | ./uninitialized.pl; # doesn't work? 59 61 60 # from http://people.redhat.com/mstefani/wine/smatch/ 62 61 if [ -f ./while_for_check.pl ]; then 63 cat $i | ./while_for_check.pl; 62 cat $i | ./while_for_check.pl; # works 64 63 fi 65 64 # --> end wine <-- 66 # samhain specific 65 66 # samhain specific modifications (list of free/malloc funcs) 67 # doesn't seem to find anything useful 67 68 if [ $memcheck = xsimple ]; then 68 69 if [ -f ./samhain_unfree.pl ]; then … … 80 81 fi 81 82 # --> end samhain specific <-- 82 #cat $i | ./unfree.pl | \ 83 # egrep -v 'x_cutest_.*Test_' | \ 84 # grep -v 'x_sh_unix.c .... .... sh_unix_copyenv'; 85 touch list_null_funcs_uniq; 83 84 echo malloc > list_null_funcs_uniq; 85 echo getenv >> list_null_funcs_uniq; 86 86 cat $i | ./deference_check.pl; 87 87 rm -f list_null_funcs_uniq; -
trunk/test/testrun_1b.sh
r81 r96 246 246 # ------------- third test ------------- 247 247 # 248 if test "x$hostname" = "xtenebra" 249 then 250 if test -f /usr/local/lib/libprelude.so 251 then 252 LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" 253 export LD_LIBRARY_PATH 254 fi 255 fi 256 # 248 257 PM=`find_path prelude-manager` 249 258 if [ -z "$PM" ]; then
Note:
See TracChangeset
for help on using the changeset viewer.