[PATCH] [tldap] check for successful string conversion
swen
swen at linux.ibm.com
Thu Jan 10 10:09:09 UTC 2019
Please review and push if happy.
Thanks for your support in advance.
Cheers Swen
-------------- next part --------------
From 00da08cd146df1c11a796c036850f573b55623b3 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at linux.ibm.com>
Date: Thu, 10 Jan 2019 09:44:00 +0100
Subject: [PATCH] [tldap] check for successful string conversion
Check for successful string conversion and prevent
wrongly acceptance of zero.
Signed-off-by: Swen Schillig <swen at linux.ibm.com>
---
source3/lib/tldap_util.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index 508c6c02f80..d8a65c4e2d8 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -395,7 +395,16 @@ bool tldap_pull_uint64(struct tldap_message *msg, const char *attr,
DEBUG(10, ("Could not find attribute %s\n", attr));
return false;
}
+
+ errno = 0;
result = strtoull(str, NULL, 10);
+ if (errno != 0) {
+ DBG_DEBUG("Attribute conversion failed (%s)\n",
+ strerror(errno));
+ TALLOC_FREE(str);
+ return false;
+ }
+
TALLOC_FREE(str);
*presult = result;
return true;
--
2.20.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20190110/73e41339/signature.sig>
More information about the samba-technical
mailing list