[sr-dev] [kamailio/kamailio] cfg_rpc updates changing variable values to large random numbers (#1583)

vinesinha notifications at github.com
Wed Jul 11 20:28:37 CEST 2018


I was able to reproduce this using a sample cfg:

```
#!KAMAILIO


sample_group.a = 0

sample_group.b = 0

sample_group.c = 0

sample_group.d = 0

sample_group.e = 0

sample_group.f = 0

sample_group.g = 0

sample_group.h = 0

sample_group.i = 0

sample_group.j = 0

sample_group.k = 0

sample_group.l = 0

sample_group.m = 0

sample_group.n = 0

sample_group.o = ""

sample_group.p = 0

sample_group.q = 0

sample_group.r = 4000

sample_group.s = "null"

sample_group.t = "null"

sample_group.u = "null"

sample_group.v = "null"

sample_group.w = 0

sample_group.x = 0

sample_group.y = 0

sample_group.z = 0

sample_group.a1 = 0
```

The memory mapping is as follows:

```
START
block address: 0x7f43ed1484d8
vars address: 0x7f43ed1484dc
Total allocated size: 1352
Group number: 1
Group location from start 20
Group size: 248
Group number: 2
Group location from start 284
Group size: 56
Group number: 3
Group location from start 356
Group size: 4
Group number: 4
Group location from start 380
Group size: 4
Group number: 5
Group location from start 404
Group size: 4
Group number: 6
Group location from start 428
Group size: 176
Group number: 7
Group location from start 620
Group size: 104
Group number: 8
Group location from start 740
Group size: 200
Group number: 9
Group location from start 956
Group size: 16
Group number: 10
Group location from start 988
Group size: 172
Group number: 11
Group location from start 1180
Group size: 172
```

As you can see that group 10 and 11(created using cfg above) have the same size.

Now, if you try to get the value of sample_group.a and put a breakpoint here:

https://github.com/kamailio/kamailio/blob/master/src/core/cfg/cfg_ctx.c#L1319

i.e. run the following command 

`sudo kamctl kamcmd cfg.get sample_group a`

The offsets in gdb are as follows:

```
(gdb) print var->offset
$1 = 172
(gdb) print group->var_offset
$2 = 1176
```

Also the value is getting corrupted:

```
sudo kamctl kamcmd cfg.get sample_group a
694019999
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1583#issuecomment-404266806
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180711/7daaaad3/attachment.html>


More information about the sr-dev mailing list