]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_http_websocket.c: Fix incorrect use of sizeof in ast_websocket_write().
authorRichard Mudgett <rmudgett@digium.com>
Fri, 19 Dec 2014 20:51:41 +0000 (20:51 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 19 Dec 2014 20:51:41 +0000 (20:51 +0000)
This won't fix the reported issue but it is an incorrect use of sizeof.

ASTERISK-24566
Reported by:  Badalian Vyacheslav

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@429867 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_http_websocket.c

index 81fa83d1e8db5d9e038bf052d7168afeae352060..fbaf133fa02fc5c5e7bf27fdc437e12a3c7bdf99 100644 (file)
@@ -220,7 +220,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write)(struct ast_websocket *session, en
 {
        size_t header_size = 2; /* The minimum size of a websocket frame is 2 bytes */
        char *frame;
-       uint64_t length = 0;
+       uint64_t length;
 
        if (actual_length < 126) {
                length = actual_length;
@@ -235,7 +235,7 @@ int AST_OPTIONAL_API_NAME(ast_websocket_write)(struct ast_websocket *session, en
        }
 
        frame = ast_alloca(header_size);
-       memset(frame, 0, sizeof(*frame));
+       memset(frame, 0, header_size);
 
        frame[0] = opcode | 0x80;
        frame[1] = length;