summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-01-04 14:03:28 +0100
committerJeremy Allison <jra@samba.org>2021-01-08 20:31:33 +0000
commit41e1b340265d902b86a757cc5baea0bdc4aba748 (patch)
tree9c593c73fdb865aa51f0407ac05bd1f092b54c13 /lib/util
parent2ba7fe10951ddda3145316e6026ef470ad2e29d5 (diff)
downloadsamba-41e1b340265d902b86a757cc5baea0bdc4aba748.tar.gz
lib: Use hex_byte() in ucs2hex_pull()
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/charset/iconv.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c
index 14a1f8652e3..1f2d49c0e27 100644
--- a/lib/util/charset/iconv.c
+++ b/lib/util/charset/iconv.c
@@ -25,8 +25,6 @@
#include "lib/util/dlinklist.h"
#include "lib/util/charset/charset.h"
#include "lib/util/charset/charset_proto.h"
-#include "libcli/util/ntstatus.h"
-#include "lib/util/util_str_hex.h"
#ifdef HAVE_ICU_I18N
#include <unicode/ustring.h>
@@ -675,8 +673,9 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
while (*inbytesleft >= 1 && *outbytesleft >= 2) {
- uint64_t v;
- NTSTATUS status;
+ uint8_t hi = 0, lo = 0;
+ bool ok;
+
if ((*inbuf)[0] != '@') {
/* seven bit ascii case */
(*outbuf)[0] = (*inbuf)[0];
@@ -692,15 +691,15 @@ static size_t ucs2hex_pull(void *cd, const char **inbuf, size_t *inbytesleft,
errno = EINVAL;
return -1;
}
- status = read_hex_bytes(&(*inbuf)[1], 4, &v);
- if (!NT_STATUS_IS_OK(status)) {
+ ok = hex_byte(&(*inbuf)[1], &hi) && hex_byte(&(*inbuf)[3], &lo);
+ if (!ok) {
errno = EILSEQ;
return -1;
}
- (*outbuf)[0] = v&0xff;
- (*outbuf)[1] = v>>8;
+ (*outbuf)[0] = lo;
+ (*outbuf)[1] = hi;
(*inbytesleft) -= 5;
(*outbytesleft) -= 2;
(*inbuf) += 5;