Skip to content

Commit 5ac4c18

Browse files
Merge pull request #3 from signalwire/master
Pulling in master
2 parents f83fa02 + 8e0c0df commit 5ac4c18

File tree

146 files changed

+3101
-1587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+3101
-1587
lines changed

conf/vanilla/autoload_configs/httapi.conf.xml

+2
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
<!-- <param name="ssl-key-password" value="MyPrivateKeyPassword"/> -->
106106
<!-- optional timeout -->
107107
<!-- <param name="timeout" value="10"/> -->
108+
<!-- optional: maximum amount of time in seconds that is allowed to make the connection to the server -->
109+
<!-- <param name="connect-timeout" value="2"/> -->
108110

109111
<!-- optional: use a custom CA certificate in PEM format to verify the peer
110112
with. This is useful if you are acting as your own certificate authority.

debian/control-modules

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Module: applications/mod_hiredis
117117
Description: Redis client support
118118
This module provides a mechanism to use Redis as a datastore.
119119
Build-Depends: libhiredis-dev
120-
Depends: libhiredis0.10 | libhiredis0.13
120+
Depends: libhiredis0.10 | libhiredis0.13 | libhiredis0.14
121121

122122
Module: applications/mod_httapi
123123
Description: HT-TAPI Hypertext Telephony API

libs/apr-util/hooks/apr_hooks.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ static TSort *tsort(TSort *pData,int nItems)
180180
break;
181181
}
182182
}
183-
pTail->pNext=NULL; /* unfudge the tail */
183+
if (pTail) {
184+
pTail->pNext = NULL; /* unfudge the tail */
185+
}
184186
return pHead;
185187
}
186188

libs/apr-util/misc/apr_queue.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data)
222222
}
223223

224224
if (apr_queue_full(queue)) {
225-
rv = apr_thread_mutex_unlock(queue->one_big_mutex);
225+
apr_thread_mutex_unlock(queue->one_big_mutex);
226226
return APR_EAGAIN;
227227
}
228228

@@ -397,7 +397,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data)
397397
}
398398

399399
if (apr_queue_empty(queue)) {
400-
rv = apr_thread_mutex_unlock(queue->one_big_mutex);
400+
apr_thread_mutex_unlock(queue->one_big_mutex);
401401
return APR_EAGAIN;
402402
}
403403

libs/apr-util/xml/apr_xml.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static int find_prefix(apr_xml_parser *parser, const char *prefix)
8282
** prefix.
8383
*/
8484
for (; elem; elem = elem->parent) {
85-
apr_xml_ns_scope *ns_scope = elem->ns_scope;
85+
apr_xml_ns_scope *ns_scope;
8686

8787
for (ns_scope = elem->ns_scope; ns_scope; ns_scope = ns_scope->next) {
8888
if (strcmp(prefix, ns_scope->prefix) == 0) {

libs/apr-util/xml/expat/lib/xmltok.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ void unknown_toUtf8(const ENCODING *enc,
12251225
const char **fromP, const char *fromLim,
12261226
char **toP, const char *toLim)
12271227
{
1228-
char buf[XML_UTF8_ENCODE_MAX];
1228+
char buf[XML_UTF8_ENCODE_MAX] = {0};
12291229
for (;;) {
12301230
const char *utf8;
12311231
int n;

libs/apr/file_io/unix/filepath.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
133133
* but required since the compiler (at least vc) doesn't like
134134
* passing the address of a char const* for a char** arg.
135135
*/
136-
char *getpath;
136+
char *getpath = NULL;
137137
rv = apr_filepath_get(&getpath, flags, p);
138138
rootpath = getpath;
139139
if (rv != APR_SUCCESS)
140140
return errno;
141141

142+
if (!getpath)
143+
return APR_ENOMEM;
144+
142145
/* XXX: Any kernel subject to goofy, uncanonical results
143146
* must run the rootpath against the user's given flags.
144147
* Simplest would be a recursive call to apr_filepath_merge

libs/apr/file_io/unix/filestat.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
130130
apr_pool_t *pool)
131131
{
132132
apr_status_t status;
133-
apr_finfo_t finfo;
133+
apr_finfo_t finfo = {0};
134134

135135
/* Don't do anything if we can't handle the requested attributes */
136136
if (!(attr_mask & (APR_FILE_ATTR_READONLY
@@ -185,7 +185,7 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
185185
apr_pool_t *pool)
186186
{
187187
apr_status_t status;
188-
apr_finfo_t finfo;
188+
apr_finfo_t finfo = {0};
189189

190190
status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
191191
if (status) {

libs/apr/memory/unix/apr_pools.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,17 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
821821
if (!abort_fn && parent)
822822
abort_fn = parent->abort_fn;
823823

824-
if (allocator == NULL)
824+
if (allocator == NULL) {
825+
if (!parent) {
826+
/* There is no way to continue without an allocator when no parent */
827+
if (abort_fn)
828+
abort_fn(APR_EINVAL);
829+
830+
return APR_EINVAL;
831+
}
832+
825833
allocator = parent->allocator;
834+
}
826835

827836
if ((node = allocator_alloc(allocator,
828837
MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {

libs/apr/misc/unix/otherchild.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ APR_DECLARE(void) apr_proc_other_child_unregister(void *data)
9696
}
9797

9898
/* segfault if this function called with invalid parm */
99-
apr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup);
99+
if (cur) apr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup);
100100
other_child_cleanup(data);
101101
}
102102

libs/apr/network_io/unix/sendrecv.c

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include <osreldate.h>
2828
#endif
2929

30+
#include <assert.h> /* assert() */
31+
3032
apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf,
3133
apr_size_t *len)
3234
{
@@ -287,6 +289,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
287289

288290
/* Ignore flags for now. */
289291
flags = 0;
292+
assert(flags==0);
290293

291294
if (hdtr->numheaders > 0) {
292295
apr_size_t hdrbytes;

libs/apr/network_io/unix/sockets.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ static apr_status_t socket_cleanup(void *sock)
3232
{
3333
apr_socket_t *thesocket = sock;
3434

35-
if (thesocket && thesocket->socketdes == -1) {
35+
if (!thesocket) {
36+
return APR_ENOTSOCK;
37+
}
38+
39+
if (thesocket->socketdes == -1) {
3640
return APR_SUCCESS;
3741
}
3842

libs/apr/random/unix/sha2.c

+29
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,16 @@ void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
444444

445445
/* Clean up */
446446
a = b = c = d = e = f = g = h = T1 = T2 = 0;
447+
assert(a==0);
448+
assert(b==0);
449+
assert(c==0);
450+
assert(d==0);
451+
assert(e==0);
452+
assert(f==0);
453+
assert(g==0);
454+
assert(h==0);
455+
assert(T1==0);
456+
assert(T2==0);
447457
}
448458

449459
#endif /* SHA2_UNROLL_TRANSFORM */
@@ -478,6 +488,8 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len)
478488
context->bitcount += len << 3;
479489
/* Clean up: */
480490
usedspace = freespace = 0;
491+
assert(usedspace==0);
492+
assert(freespace==0);
481493
return;
482494
}
483495
}
@@ -495,6 +507,8 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len)
495507
}
496508
/* Clean up: */
497509
usedspace = freespace = 0;
510+
assert(usedspace==0);
511+
assert(freespace==0);
498512
}
499513

500514
void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
@@ -559,6 +573,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
559573
/* Clean up state data: */
560574
MEMSET_BZERO(context, sizeof(*context));
561575
usedspace = 0;
576+
assert(usedspace==0);
562577
}
563578

564579
char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) {
@@ -768,6 +783,16 @@ void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
768783

769784
/* Clean up */
770785
a = b = c = d = e = f = g = h = T1 = T2 = 0;
786+
assert(a==0);
787+
assert(b==0);
788+
assert(c==0);
789+
assert(d==0);
790+
assert(e==0);
791+
assert(f==0);
792+
assert(g==0);
793+
assert(h==0);
794+
assert(T1==0);
795+
assert(T2==0);
771796
}
772797

773798
#endif /* SHA2_UNROLL_TRANSFORM */
@@ -802,6 +827,8 @@ void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len)
802827
ADDINC128(context->bitcount, len << 3);
803828
/* Clean up: */
804829
usedspace = freespace = 0;
830+
assert(usedspace==0);
831+
assert(freespace==0);
805832
return;
806833
}
807834
}
@@ -819,6 +846,8 @@ void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len)
819846
}
820847
/* Clean up: */
821848
usedspace = freespace = 0;
849+
assert(usedspace==0);
850+
assert(freespace==0);
822851
}
823852

824853
void apr__SHA512_Last(SHA512_CTX* context) {

libs/apr/strings/apr_snprintf.c

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign,
110110
arg = -arg;
111111
}
112112
arg = modf(arg, &fi);
113-
p1 = &buf[NDIG];
114113
/*
115114
* Do integer part
116115
*/

libs/apr/strings/apr_strings.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ APR_DECLARE(void *) apr_pmemdup(apr_pool_t *a, const void *m, apr_size_t n)
124124
APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *a, ...)
125125
{
126126
char *cp, *argp, *res;
127-
apr_size_t saved_lengths[MAX_SAVED_LENGTHS];
127+
apr_size_t saved_lengths[MAX_SAVED_LENGTHS] = { 0 };
128128
int nargs = 0;
129129

130130
/* Pass one --- find length of required string */

libs/apr/tables/apr_hash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
459459
break;
460460
}
461461
}
462-
if (!ent) {
462+
if (new_vals && !ent) {
463463
new_vals[j].klen = iter->klen;
464464
new_vals[j].key = iter->key;
465465
new_vals[j].val = iter->val;

libs/iksemel/src/ikstack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static ikschunk *
3232
find_space (ikstack *s, ikschunk *c, size_t size)
3333
{
3434
/* FIXME: dont use *2 after over allocated chunks */
35-
while (1) {
35+
while (c) {
3636
if (c->size - c->used >= size) return c;
3737
if (!c->next) {
3838
if ((c->size * 2) > size) size = c->size * 2;

libs/iksemel/src/sax.c

-6
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,16 @@ sax_core (iksparser *prs, char *buf, int len)
213213
goto cont;
214214
} else {
215215
if (c & 0x80) {
216-
unsigned char mask;
217216
if ((c & 0x60) == 0x40) {
218217
prs->uni_max = 2;
219-
mask = 0x1F;
220218
} else if ((c & 0x70) == 0x60) {
221219
prs->uni_max = 3;
222-
mask = 0x0F;
223220
} else if ((c & 0x78) == 0x70) {
224221
prs->uni_max = 4;
225-
mask = 0x07;
226222
} else if ((c & 0x7C) == 0x78) {
227223
prs->uni_max = 5;
228-
mask = 0x03;
229224
} else if ((c & 0x7E) == 0x7C) {
230225
prs->uni_max = 6;
231-
mask = 0x01;
232226
} else {
233227
return IKS_BADXML;
234228
}

libs/iksemel/test/tst-ikstack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test_stack (int cs)
3636
memset (mem, 'x', i);
3737
old = iks_stack_strcat (s, old, 0, buf + i, 1);
3838
}
39-
if (strcmp (old, buf) != 0) {
39+
if (old && strcmp (old, buf) != 0) {
4040
printf ("ikstack strcat bug:\nExpected: %s\n Result: %s\n", buf, old);
4141
exit (1);
4242
}

libs/iksemel/test/tst-sax.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ tagHook (void *udata, char *name, char **atts, int type)
160160
nr = tester.cur->nr_atts;
161161
while (nr) {
162162
flag = 0;
163-
for (i = 0;atts[i]; i+= 2) {
163+
for (i = 0;atts&&atts[i]; i+= 2) {
164164
if (iks_strcmp (atts[i], tester.cur->atts[nr-1]) == 0 && iks_strcmp (atts[i+1], tester.cur->vals[nr-1]) == 0) {
165165
flag = 1;
166166
break;

libs/iksemel/tools/hash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ hash_print (hash *h, char *title_fmt, char *line_fmt)
117117
struct item **tags, *t;
118118
unsigned int i = 0, pos = 0;
119119

120-
tags = calloc (sizeof (struct tag *), h->count);
120+
tags = calloc (sizeof (struct item *), h->count);
121121

122122
for (; i < h->size; i ++) {
123123
for (t = h->table[i]; t; t = t->next) {

libs/iksemel/tools/iksperf.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ serialize_test (char *buf, int len)
207207
unsigned long time;
208208
iks *x;
209209
iksparser *prs;
210-
char *xml;
211210
int err;
212211

213212
prs = iks_dom_new (&x);
@@ -228,7 +227,7 @@ serialize_test (char *buf, int len)
228227

229228
t_reset ();
230229

231-
xml = iks_string (iks_stack (x), x);
230+
iks_string (iks_stack (x), x);
232231

233232
time = t_elapsed ();
234233

libs/libdingaling/src/libdingaling.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,10 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from,
499499
unsigned int *candidate_len = NULL;
500500
ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL;
501501

502-
if ((key = iks_find_attrib(tag, "preference"))) {
502+
if (!(key = iks_find_attrib(tag, "preference"))) {
503+
globals.logger(DL_LOG_WARNING, "Field preference was not set\n");
504+
continue;
505+
} else {
503506
unsigned int x;
504507

505508
pref = strtod(key, NULL);
@@ -927,7 +930,7 @@ static int on_disco_default(void *user_data, ikspak *pak)
927930
char *node = NULL;
928931
char *ns = NULL;
929932
ldl_handle_t *handle = user_data;
930-
iks *iq, *query, *tag;
933+
iks *iq = NULL, *query, *tag;
931934
uint8_t send = 0;
932935
int x;
933936

@@ -936,10 +939,10 @@ static int on_disco_default(void *user_data, ikspak *pak)
936939
node = iks_find_attrib(pak->query, "node");
937940
}
938941

939-
if (pak->subtype == IKS_TYPE_RESULT) {
942+
if (pak && pak->subtype == IKS_TYPE_RESULT) {
940943
globals.logger(DL_LOG_CRIT, "FixME!!! node=[%s]\n", node?node:"");
941-
} else if (pak->subtype == IKS_TYPE_GET) {
942-
if ((iq = iks_new("iq"))) {
944+
} else if (pak && pak->subtype == IKS_TYPE_GET) {
945+
if (ns && (iq = iks_new("iq"))) {
943946
int all = 0;
944947

945948
iks_insert_attrib(iq, "from", handle->login);
@@ -1081,7 +1084,6 @@ static int on_presence(void *user_data, ikspak *pak)
10811084
if (ext && strstr(ext, "voice-v1") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) {
10821085
apr_cpystrn(buffer->buf, from, buffer->len);
10831086
buffer->hit = 1;
1084-
done = 1;
10851087
}
10861088
}
10871089
}
@@ -1149,7 +1151,6 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
11491151

11501152
bytes = read(fd, image, sizeof(image));
11511153
close(fd);
1152-
fd = -1;
11531154

11541155
ap = malloc(sizeof(*ap));
11551156
assert(ap != NULL);
@@ -2565,7 +2566,6 @@ unsigned int ldl_session_candidates(ldl_session_t *session,
25652566
iq = NULL;
25662567
sess = NULL;
25672568
tag = NULL;
2568-
x = 0;
25692569
id = 0;
25702570
}
25712571

0 commit comments

Comments
 (0)