FM: Resolve KW issues.

Use more safe snprintf and thread safe strtok_r.

Change-Id: I7ae8d94c7ab1e1c7e3b6a3b4b0dce703f9dcddce
diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp
index b97c554..9eea048 100644
--- a/jni/android_hardware_fm.cpp
+++ b/jni/android_hardware_fm.cpp
@@ -108,7 +108,7 @@
     if( err >= 0 ) {
        ALOGD("Driver Version(Same as ChipId): %x \n",  cap.version );
        /*Conver the integer to string */
-       sprintf(versionStr, "%d", cap.version );
+       snprintf(versionStr, sizeof(versionStr), "%d", cap.version);
        property_set("hw.fm.version", versionStr);
     } else {
        return FM_JNI_FAILURE;
diff --git a/libfm_jni/ConfigFmThs.cpp b/libfm_jni/ConfigFmThs.cpp
index 19ee12b..dd6b283 100644
--- a/libfm_jni/ConfigFmThs.cpp
+++ b/libfm_jni/ConfigFmThs.cpp
@@ -488,12 +488,13 @@
 )
 {
     char *next_freq;
+    char *saveptr;
     unsigned int freq;
     unsigned int *freqs_new_arr;
     unsigned int size = 0;
     unsigned int len = 0;
 
-    next_freq = strtok(freqs, str);
+    next_freq = strtok_r(freqs, str, &saveptr);
     while(next_freq != NULL) {
           freq = atoi(next_freq);
           ALOGD("HYBRID_SRCH freq: %u\n", freq);
@@ -512,7 +513,7 @@
           }
           (*freqs_arr)[len] = freq;
           len++;
-          next_freq = strtok(NULL, str);
+          next_freq = strtok_r(NULL, str, &saveptr);
     }
     return len;
 }
@@ -525,12 +526,13 @@
 )
 {
     char *next_sinr;
+    char *saveptr;
     signed char *sinrs_new_arr;
     unsigned int size = 0;
     unsigned int len = 0;
     signed char sinr;
 
-    next_sinr = strtok(sinrs, str);
+    next_sinr = strtok_r(sinrs, str, &saveptr);
     while(next_sinr != NULL) {
           sinr = atoi(next_sinr);
           ALOGD("HYBRID_SRCH sinr: %d\n", sinr);
@@ -549,7 +551,7 @@
           }
           (*sinrs_arr)[len] = sinr;
           len++;
-          next_sinr = strtok(NULL, str);
+          next_sinr = strtok_r(NULL, str,&saveptr);
     }
     return len;
 }