diff options
author | Dongwon Kang <dwkang@google.com> | 2011-04-13 14:39:37 +0900 |
---|---|---|
committer | Dongwon Kang <dwkang@google.com> | 2011-04-13 14:39:37 +0900 |
commit | 189fc1d078bf9bb74fa74645b6d6c4e3b58da001 (patch) | |
tree | e5f3e5ecbb4dd472ebb4e2e6e23fa9dbe532f77d | |
parent | 2856a2765bf15a8677a481cf8a38d0ad17f31a6e (diff) | |
download | jhead-189fc1d078bf9bb74fa74645b6d6c4e3b58da001.tar.gz |
Better non-ascii character filtering.
(Note: in some platform, the range of char is [-128, 127] rather than [0, 255].)
Change-Id: I338f625879fe66abbeafc13b682639cd67c887c9
-rw-r--r-- | main.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -35,6 +35,7 @@ SUCH DAMAGE. #include <nativehelper/jni.h> #include <assert.h> +#include <ctype.h> #include <dlfcn.h> #include <stdio.h> #include <string.h> @@ -701,7 +702,7 @@ static jstring getAttributes(JNIEnv *env, jobject jobj, jstring jfilename) snprintf(finalResult, finalBufLen, "%d %s", attributeCount, buf); int k; for (k = 0; k < finalBufLen; k++) - if (finalResult[k] > 127) + if (!isascii(finalResult[k])) finalResult[k] = '?'; free(buf); |