diff --git a/src/pefile.cpp b/src/pefile.cpp index 0f1bce79..2f6c81f3 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -874,7 +874,9 @@ unsigned PeFile::processImports0(ord_mask_t ord_mask) // pass 1 if (u2->ordinal) return 1; if (!u1->shname) return 1; if (!u2->shname) return -1; - return strlen(u1->shname) - strlen(u2->shname); + rc = (int) (upx_strlen(u1->shname) - upx_strlen(u2->shname)); + if (rc) return rc; + return strcmp(u1->shname, u2->shname); } }; diff --git a/src/util.h b/src/util.h index 0f1aebf2..b1f20045 100644 --- a/src/util.h +++ b/src/util.h @@ -100,6 +100,10 @@ inline char *strcpy(unsigned char *s1, const unsigned char *s2) { return strcpy((char *) s1, (const char *) s2); } +inline int strcmp(const unsigned char *s1, const unsigned char *s2) { + return strcmp((const char *) s1, (const char *) s2); +} + inline int strcasecmp(const unsigned char *s1, const unsigned char *s2) { return strcasecmp((const char *) s1, (const char *) s2); }