Changeset 11
- Timestamp:
- Jan 2, 2006, 12:03:25 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/slib.h
r8 r11 147 147 */ 148 148 void *sl_memset(void *s, int c, size_t n); 149 #if !defined(SH_REAL_SET) 149 150 #undef memset 150 151 #define memset sl_memset 152 #endif 151 153 152 154 /* -
trunk/src/sh_database.c
r3 r11 32 32 /* define this if you want to debug the Oracle database support */ 33 33 /* #define DB_DEBUG */ 34 35 #define SH_REAL_SET 34 36 35 37 #include "samhain.h" -
trunk/src/sh_error.c
r5 r11 802 802 { 803 803 if (str == NULL) 804 memset(inet_peer, '\0', SH_MINIBUF);804 inet_peer[0] = '\0'; 805 805 else 806 806 sl_strlcpy(inet_peer, str, SH_MINIBUF); -
trunk/src/sh_forward.c
r3 r11 249 249 else 250 250 { 251 memset (name_2, 0, SH_MINIBUF+1);252 251 first = name; 253 252 while (i < SH_MINIBUF && *first != '.' && *first != '\0') … … 256 255 ++first; ++i; 257 256 } 258 name_2[ SH_MINIBUF] = '\0';257 name_2[i] = '\0'; 259 258 } 260 259 } … … 2071 2070 2072 2071 2073 2072 static char zap_challenge[SH_CHALLENGE_SIZE] = { 0 }; 2073 2074 2074 void sh_forward_do_free (sh_conn_t * conn) 2075 2075 { … … 2101 2101 conn->fd = -1; 2102 2102 } 2103 mem set(conn->challenge, '\0', SH_CHALLENGE_SIZE);2103 memcpy(conn->challenge, zap_challenge, SH_CHALLENGE_SIZE); 2104 2104 conn->state = CONN_FREE; 2105 2105 conn->headcount = 0; … … 2118 2118 conn->FileLength = 0; 2119 2119 conn->FileSent = 0; 2120 memset(conn->FileType, '\0', 5); 2120 conn->FileType[0] = '\0'; 2121 conn->FileType[1] = '\0'; 2122 conn->FileType[2] = '\0'; 2123 conn->FileType[3] = '\0'; 2124 conn->FileType[4] = '\0'; 2121 2125 2122 2126 --server_status.conn_open; -
trunk/src/sh_mem.c
r1 r11 32 32 #endif 33 33 34 #define SH_REAL_SET 35 34 36 #include "samhain.h" 35 37 #include "sh_error.h" -
trunk/src/sh_tiger0.c
r8 r11 422 422 int md5Reset(register md5Param* p) 423 423 { 424 unsigned int i; 424 425 memcpy(p->h, md5hinit, 16); 425 memset(p->data, 0x00, 64); 426 427 for (i = 0; i < 16; i += 8) 428 { 429 p->data[i] = 0x00; 430 p->data[i+1] = 0x00; 431 p->data[i+2] = 0x00; 432 p->data[i+3] = 0x00; 433 p->data[i+4] = 0x00; 434 p->data[i+5] = 0x00; 435 p->data[i+6] = 0x00; 436 p->data[i+7] = 0x00; 437 } 438 439 /* memset(p->data, 0x00, 64); */ 426 440 p->offset = (uint8) 0; 427 441 p->nblocks = 0; … … 1527 1541 SL_ENTER(_("sh_tiger_hash_uint32")); 1528 1542 1529 memset(out, 0, 6 * sizeof(UINT32)); 1543 out[0] = 0; out[1] = 0; out[2] = 0; 1544 out[3] = 0; out[4] = 0; out[5] = 0; 1530 1545 1531 1546 res = sh_tiger_hash_val (filename, what, Length, 0); -
trunk/src/sh_tools.c
r1 r11 78 78 #endif 79 79 80 #define SH_REAL_SET 81 80 82 #include "samhain.h" 81 83 #include "sh_mem.h" … … 121 123 char * sh_tools_safe_name (const char * instr, int flag) 122 124 { 125 static char ctest = ~('\\'|'&'|'='|'\''); 123 126 unsigned char c; 124 127 const char * p; 125 128 char tmp[4]; 126 129 char * outstr; 127 int len ;130 int len = 1; 128 131 int i = 0; 129 132 unsigned char val_octal = '\0'; … … 133 136 if (instr) 134 137 len = (3 * strlen(instr)) + 4; 135 else136 len = 1;137 138 138 139 outstr = SH_ALLOC(len); … … 143 144 p = instr; 144 145 145 while (p && *p) 146 #if !defined(SH_USE_XML) 147 (void) flag; /* fix compiler warning */ 148 #endif 149 150 if (!p) 151 goto end; 152 153 while (*p) 146 154 { 147 155 c = *p; … … 154 162 155 163 #ifdef SH_USE_XML 156 if (flag == 1 && (*p) == '"') 157 { 158 sprintf(&outstr[i], "=%02x", c); i+=3; ++p; /* known to fit */ 159 continue; 160 } 161 else if (flag == 1 && (*p) == '&') 162 { 163 sprintf(&outstr[i], "=%02x", c); i+=3; ++p; /* known to fit */ 164 continue; 165 } 166 else if (flag == 1 && (*p) == '<') 167 { /* left angle */ 168 sprintf(&outstr[i], "=%02x", c); i+=3; ++p; /* known to fit */ 169 continue; 170 } 171 else if (flag == 1 && (*p) == '>') 172 { /* right angle */ 173 sprintf(&outstr[i], "=%02x", c); i+=3; ++p; /* known to fit */ 174 continue; 164 if (flag == 1) 165 { 166 if ((*p) == '"') 167 { 168 sprintf(&outstr[i], "=%02x", c);i+=3; ++p; /* known to fit */ 169 continue; 170 } 171 else if ((*p) == '&') 172 { 173 sprintf(&outstr[i], "=%02x", c);i+=3; ++p; /* known to fit */ 174 continue; 175 } 176 else if ((*p) == '<') 177 { /* left angle */ 178 sprintf(&outstr[i], "=%02x", c);i+=3; ++p; /* known to fit */ 179 continue; 180 } 181 else if ((*p) == '>') 182 { /* right angle */ 183 sprintf(&outstr[i], "=%02x", c);i+=3; ++p; /* known to fit */ 184 continue; 185 } 175 186 } 176 #else 177 (void) flag; /* fix compiler warning */ 178 #endif 179 180 if ( (*p) != '\\' && (*p) != '&' && (*p) != '=' && (*p) != '\'') 187 #endif 188 189 /* if ( (*p) != '\\' && (*p) != '&' && (*p) != '=' && (*p) != '\'') */ 190 if (((*p) & ctest) != 0) 181 191 { 192 outstr[i] = *p; ++i; 193 ++p; 194 182 195 if (c < 31 || c > 126) 183 196 { 184 sprintf(&outstr[i], "=%02x", c); i+=3; ++p;/* known to fit */ 197 --i; 198 sprintf(&outstr[i], "=%02x", c); /* known to fit */ 185 199 } 186 else 187 { 188 outstr[i] = *p; 189 ++i; ++p; 190 } 200 191 201 continue; 192 202 } … … 272 282 } 273 283 } 274 else /* *p == '&' */284 else if (*p == '&') 275 285 { 276 286 ++p; … … 303 313 outstr[i] = '&'; ++i; 304 314 } 305 } 315 } 316 else 317 { 318 outstr[i] = *p; ++i; 319 ++p; 320 } 306 321 } /* while (p && *p) */ 322 323 end: 307 324 308 325 outstr[i] = '\0'; -
trunk/src/sh_utils.c
r1 r11 527 527 (char)0x36, (char)0x36, (char)0x36, (char)0x36, (char)0x36, (char)0x36 528 528 }; 529 static char zap[KEY_BLOCK] = { 530 (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 531 (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 532 (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 533 (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00 534 }; 529 535 char K[KEY_BLOCK]; 530 536 char outer[KEY_BLOCK]; … … 546 552 } 547 553 548 mem set (K, 0x00, KEY_BLOCK);554 memcpy (K, zap, KEY_BLOCK); 549 555 550 556 if (sh_util_hextobinary (K, hexkey, KEY_LEN) < 0) … … 773 779 * input for a one-way hash function. 774 780 */ 781 UINT32 taus_svec[6]; 782 775 783 UINT32 taus_get (void *state1, void *state2, void *state3) 776 784 { 777 UINT32 svec[6];778 785 UINT32 retval; 779 786 UINT32 * res; 780 787 register int i; 781 788 782 svec[0] = taus_get_long (state1);783 svec[1] = taus_get_long (state2);784 svec[2] = taus_get_long (state3);785 svec[3] = taus_get_long (state1);786 svec[4] = taus_get_long (state2);787 svec[5] = taus_get_long (state3);788 789 res = sh_tiger_hash_uint32 ( (char *) & svec[0],789 taus_svec[0] = taus_get_long (state1); 790 taus_svec[1] = taus_get_long (state2); 791 taus_svec[2] = taus_get_long (state3); 792 taus_svec[3] = taus_get_long (state1); 793 taus_svec[4] = taus_get_long (state2); 794 taus_svec[5] = taus_get_long (state3); 795 796 res = sh_tiger_hash_uint32 ( (char *) &taus_svec[0], 790 797 TIGER_DATA, 791 798 (unsigned long)(6 * sizeof(UINT32))); 792 799 793 800 for (i = 1; i < KEY_BYT/4; ++i) 794 res[0] ^= res[i]; 801 { 802 res[0] ^= res[i]; 803 res[i] = 0; 804 } 795 805 retval = res[0]; 796 806 797 memset (res, 0, KEY_BYT);798 memset (svec, 0, 6 * sizeof(UINT32));807 taus_svec[0] = 0; taus_svec[1] = 0; taus_svec[2] = 0; 808 taus_svec[3] = 0; taus_svec[4] = 0; taus_svec[5] = 0; 799 809 800 810 return retval;
Note:
See TracChangeset
for help on using the changeset viewer.