summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-06-19 23:19:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:18:50 -0500
commit0c88eedbeba3da627e712021a2811b01f323c16e (patch)
tree05463752d3d99ed6fd457a626ce6fc81688eb79f /source3/lib/util_str.c
parent5cccafff45bc6cae63212d94b1346c8bdf0ef551 (diff)
downloadsamba-0c88eedbeba3da627e712021a2811b01f323c16e.tar.gz
samba-0c88eedbeba3da627e712021a2811b01f323c16e.tar.bz2
samba-0c88eedbeba3da627e712021a2811b01f323c16e.zip
r16375: Klocwork #1670.
Jeremy. (This used to be commit 99605ce296663b7697d737fd521f0e4d8436d1f2)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index df84fa90a5..6fe1668e88 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -2250,15 +2250,21 @@ SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr)
SMB_BIG_UINT val = -1;
const char *p = nptr;
- while (p && *p && isspace(*p))
+ if (!p) {
+ *entptr = p;
+ return val;
+ }
+
+ while (*p && isspace(*p))
p++;
+
#ifdef LARGE_SMB_OFF_T
sscanf(p,"%llu",&val);
#else /* LARGE_SMB_OFF_T */
sscanf(p,"%lu",&val);
#endif /* LARGE_SMB_OFF_T */
if (entptr) {
- while (p && *p && isdigit(*p))
+ while (*p && isdigit(*p))
p++;
*entptr = p;
}