summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Esser2014-02-15 12:12:55 +0100
committerStefan Esser2014-02-15 12:12:55 +0100
commitd556e8afdd33cbe89ed2f3f4e2d0700e495dadc9 (patch)
tree2a3c96a799680be729b42356c89e133e74ed48aa
parent6909a29e3cb927b0600665e9291a60884da31f3a (diff)
Change algorithm a bit for empty keys to make it easier testable
-rw-r--r--session.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/session.c b/session.c
index b435c4d..3c40567 100644
--- a/session.c
+++ b/session.c
@@ -746,8 +746,8 @@ char *suhosin_generate_key(char *key, zend_bool ua, zend_bool dr, long raddr, ch
746 SDEBUG("(suhosin_generate_key) KEY: %s - UA: %s - DR: %s - RA: %s", key,_ua,_dr,_ra); 746 SDEBUG("(suhosin_generate_key) KEY: %s - UA: %s - DR: %s - RA: %s", key,_ua,_dr,_ra);
747 747
748 suhosin_SHA256Init(&ctx); 748 suhosin_SHA256Init(&ctx);
749 if (key == NULL) { 749 if (key == NULL || *key == 0) {
750 suhosin_SHA256Update(&ctx, (unsigned char*)"D3F4UL7", sizeof("D3F4UL7")); 750 suhosin_SHA256Update(&ctx, (unsigned char*)"D3F4UL7", strlen("D3F4UL7"));
751 } else { 751 } else {
752 suhosin_SHA256Update(&ctx, (unsigned char*)key, strlen(key)); 752 suhosin_SHA256Update(&ctx, (unsigned char*)key, strlen(key));
753 } 753 }