From 6ff1180a829744d9f7b87bb8062963667ec8aa19 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 13 Nov 2006 06:17:50 +0000 Subject: [PATCH] Remove \n, \t, \r from strings. --- CASA/micasadk/sscs_ndk.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CASA/micasadk/sscs_ndk.c b/CASA/micasadk/sscs_ndk.c index e3ed7dd1..6adca060 100644 --- a/CASA/micasadk/sscs_ndk.c +++ b/CASA/micasadk/sscs_ndk.c @@ -69,7 +69,7 @@ static int32_t sscsshs_AddSHSEntry { /* beginning of the call */ /* ############################## CODE STARTS HERE ############################ */ - if((keyLen) && (secretHandle)) + if((keyLen) && (valLen) && (secretHandle)) { if(ll_InsertSharedSecretLink((LL_LINKLIST_T*)secretHandle, keyLen, key, valLen, val)) @@ -198,6 +198,13 @@ static void sscsshs_ChkEscapeString switch(c) { + case (SS_UTF8_T)'\n': + case (SS_UTF8_T)'\r': + case (SS_UTF8_T)'\t': + k++; + escaped = 1; + break; + case (SS_UTF8_T)'\\': tempBuf[k++] = (SS_UTF8_T)'\\'; tempBuf[k++] = (SS_UTF8_T)'\\'; @@ -1130,6 +1137,7 @@ miCASAReadSecret memset(key, 0, NSSCS_MAX_SECRET_ID_LEN); memset(val, 0, NSSCS_MAX_SECRET_BUF_LEN); + kLen = vLen = 0; } // did we exhaust the buffer? @@ -2811,7 +2819,7 @@ miCASA_AddSHSEntry /* ############################## CODE STARTS HERE ############################ */ - if((keyLen) && (secretHandle)) + if((keyLen) && (valueLen) && (secretHandle)) { if(ll_InsertSharedSecretLink((LL_LINKLIST_T*)secretHandle, keyLen, key, valueLen, value))