Skip to content

Commit efb9e16

Browse files
committed
rtpproxy: alocate anonymous structures in local scope
RTPP_CMD_IOVEC and RTPP_VCMD_INIT_STATIC are initializing a variable with the content of another (anonymous one). If we however create the anonymous variable in a block's scope, it will be unavailable at the end of the block, resulting in invalid memory access - allocating the structures in the function's context (rather than a block's context) fixes this issue. Bug introduced in 0d7a71b.
1 parent 2886f8b commit efb9e16

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/rtpproxy/rtpproxy_vcmd.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,15 @@ struct rtpproxy_vcmd {
3434
static struct iovec var[nitems + 2] = \
3535
{{.iov_base = NULL /* cookie */}, __VA_ARGS__, {.iov_base = NULL /* terminator */}};
3636

37-
#define RTPP_VCMD_INIT(vcmd, nitems, ...) { \
37+
#define RTPP_VCMD_INIT(vcmd, nitems, ...) \
3838
(vcmd).vs = RTPP_CMD_IOVEC(nitems, __VA_ARGS__); \
3939
(vcmd).vu = (vcmd).vs + 1; \
4040
(vcmd).useritems = nitems; \
41-
}
4241

43-
#define RTPP_VCMD_INIT_STATIC(vcmd, nitems, ...) { \
42+
#define RTPP_VCMD_INIT_STATIC(vcmd, nitems, ...) \
4443
RTPP_CMD_IOVEC_STATIC(_var, nitems, __VA_ARGS__); \
4544
(vcmd).vs = _var; \
4645
(vcmd).vu = (vcmd).vs + 1; \
4746
(vcmd).useritems = nitems; \
48-
}
4947

5048
#endif

0 commit comments

Comments
 (0)