Module: kamailio
Branch: 5.3
Commit: ac16e21715e57befcba386e74214fa482bdf97d7
URL:
https://github.com/kamailio/kamailio/commit/ac16e21715e57befcba386e74214fa4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-07T10:52:23+02:00
core: str2int() test first if result is null, otherwise init it to 0
(cherry picked from commit b83a165e2d0e34c9bca742708c1891eb114bae04)
---
Modified: src/core/ut.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ac16e21715e57befcba386e74214fa4…
Patch:
https://github.com/kamailio/kamailio/commit/ac16e21715e57befcba386e74214fa4…
---
diff --git a/src/core/ut.h b/src/core/ut.h
index 88df8dba65..2259aea973 100644
--- a/src/core/ut.h
+++ b/src/core/ut.h
@@ -635,12 +635,12 @@ static inline int str2int(str* _s, unsigned int* _r)
{
int i;
- if (_s == NULL) return -1;
if (_r == NULL) return -1;
+ *_r = 0;
+ if (_s == NULL) return -1;
if (_s->len < 0) return -1;
if (_s->s == NULL) return -1;
- *_r = 0;
for(i = 0; i < _s->len; i++) {
if ((_s->s[i] >= '0') && (_s->s[i] <= '9')) {
*_r *= 10;