aboutsummaryrefslogtreecommitdiffstats
path: root/libexfat/lookup.c
diff options
context:
space:
mode:
authorrelan <relan@users.noreply.github.com>2009-09-28 08:45:26 +0000
committerrelan <relan@users.noreply.github.com>2015-08-24 08:26:10 +0300
commit26ab8a8e360cd0c977366e55acec446054d0923e (patch)
tree21b2f4b1f131602fb372874d9ec4847c378c9721 /libexfat/lookup.c
parentc843e18ce91e9a7a6629fc779a09ddb8860470bc (diff)
downloadandroid_external_exfat-26ab8a8e360cd0c977366e55acec446054d0923e.tar.gz
android_external_exfat-26ab8a8e360cd0c977366e55acec446054d0923e.tar.bz2
android_external_exfat-26ab8a8e360cd0c977366e55acec446054d0923e.zip
Fix integer underflow in compare_char().
Diffstat (limited to 'libexfat/lookup.c')
-rw-r--r--libexfat/lookup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libexfat/lookup.c b/libexfat/lookup.c
index 0f60a31..a40550b 100644
--- a/libexfat/lookup.c
+++ b/libexfat/lookup.c
@@ -215,9 +215,9 @@ int exfat_readdir(struct exfat* ef, struct exfat_node* node,
static int compare_char(struct exfat* ef, uint16_t a, uint16_t b)
{
if (a >= ef->upcase_chars || b >= ef->upcase_chars)
- return a - b;
- else
- return le16_to_cpu(ef->upcase[a]) - le16_to_cpu(ef->upcase[b]);
+ return (int) a - (int) b;
+
+ return (int) le16_to_cpu(ef->upcase[a]) - (int) le16_to_cpu(ef->upcase[b]);
}
static int compare_name(struct exfat* ef, const le16_t* a, const le16_t* b)