{"action":"created","issue":{"url":"https://api.github.com/repos/KoynovStas/wsdd/issues/2","repository_url":"https://api.github.com/repos/KoynovStas/wsdd","labels_url":"https://api.github.com/repos/KoynovStas/wsdd/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/KoynovStas/wsdd/issues/2/comments","events_url":"https://api.github.com/repos/KoynovStas/wsdd/issues/2/events","html_url":"https://github.com/KoynovStas/wsdd/pull/2","id":385655508,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0NTc0MTA2","number":2,"title":"Fixed a potential stack overflow","user":{"login":"ingjieye","id":13421169,"node_id":"MDQ6VXNlcjEzNDIxMTY5","avatar_url":"https://avatars0.githubusercontent.com/u/13421169?v=4","gravatar_id":"","url":"https://api.github.com/users/ingjieye","html_url":"https://github.com/ingjieye","followers_url":"https://api.github.com/users/ingjieye/followers","following_url":"https://api.github.com/users/ingjieye/following{/other_user}","gists_url":"https://api.github.com/users/ingjieye/gists{/gist_id}","starred_url":"https://api.github.com/users/ingjieye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ingjieye/subscriptions","organizations_url":"https://api.github.com/users/ingjieye/orgs","repos_url":"https://api.github.com/users/ingjieye/repos","events_url":"https://api.github.com/users/ingjieye/events{/privacy}","received_events_url":"https://api.github.com/users/ingjieye/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-29T10:00:23Z","updated_at":"2018-11-29T11:41:32Z","closed_at":"2018-11-29T11:41:32Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/KoynovStas/wsdd/pulls/2","html_url":"https://github.com/KoynovStas/wsdd/pull/2","diff_url":"https://github.com/KoynovStas/wsdd/pull/2.diff","patch_url":"https://github.com/KoynovStas/wsdd/pull/2.patch"},"body":"At\r\n\r\nhttps://github.com/KoynovStas/wsdd/blob/46ba07be8510bdef6e9213badafb8d71e4f7e60d/src/wsdd.c#L337\r\n\r\nWe pass the memory address of struct `imr_address` to function `get_addr_of_if`, then `get_addr_of_if` will copy `sizeof(struct sockaddr_in)` amount memory to this address.\r\n\r\nhttps://github.com/KoynovStas/wsdd/blob/46ba07be8510bdef6e9213badafb8d71e4f7e60d/src/net_utils.c#L181-L193\r\n\r\nHowever, `sizeof(struct sockaddr_in)` is larger then `sizeof(struct imr_address)` , so this could cause a potential stack overflow if the compiler doesn't preserve enough memory for stack, or could just mess up with the stack. (For example on a arm machine)\r\n\r\nSo I fixed it. Tested on both x86 and arm, worked just fine."},"comment":{"url":"https://api.github.com/repos/KoynovStas/wsdd/issues/comments/442803692","html_url":"https://github.com/KoynovStas/wsdd/pull/2#issuecomment-442803692","issue_url":"https://api.github.com/repos/KoynovStas/wsdd/issues/2","id":442803692,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MjgwMzY5Mg==","user":{"login":"KoynovStas","id":12393418,"node_id":"MDQ6VXNlcjEyMzkzNDE4","avatar_url":"https://avatars2.githubusercontent.com/u/12393418?v=4","gravatar_id":"","url":"https://api.github.com/users/KoynovStas","html_url":"https://github.com/KoynovStas","followers_url":"https://api.github.com/users/KoynovStas/followers","following_url":"https://api.github.com/users/KoynovStas/following{/other_user}","gists_url":"https://api.github.com/users/KoynovStas/gists{/gist_id}","starred_url":"https://api.github.com/users/KoynovStas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KoynovStas/subscriptions","organizations_url":"https://api.github.com/users/KoynovStas/orgs","repos_url":"https://api.github.com/users/KoynovStas/repos","events_url":"https://api.github.com/users/KoynovStas/events{/privacy}","received_events_url":"https://api.github.com/users/KoynovStas/received_events","type":"User","site_admin":false},"created_at":"2018-11-29T11:41:32Z","updated_at":"2018-11-29T11:41:32Z","author_association":"OWNER","body":"Thanks for the pull request!\r\n\r\nSorry, but your code is not correct - **it does not compile**!.\r\n\r\nYou forgot to change the function definition in the header file.\r\nYou forgot to set the `addr_len` parameter for `get_addr_of_if` in the `void init_gsoap()` function.\r\n\r\nThe `get_addr_of_if` function takes the second argument (Address families), which\r\n**must be** `AF_INET` or `AF_INET6`!\r\n\r\nIf you use the `get_addr_of_if` function, you yourself must monitor the parameters passed.\r\n\r\nFor the `AF_INET` type, you must use `struct sockaddr_in`\r\nFor type `AF_INET6`, you must use `struct sockaddr_in6`\r\n\r\nIn general, you can use` struct sockaddr_storage`,\r\nbut then you will need to use additional **static_cast** `(struct sockaddr_in) `or `(struct sockaddr_in6)`\r\n\r\nSee the note in [http://man7.org/linux/man-pages/man7/ipv6.7.html](http://man7.org/linux/man-pages/man7/ipv6.7.html)\r\n\r\n> The sockaddr_in6 structure is bigger than the generic sockaddr.\r\n> Programs that assume you can\r\n> struct sockaddr for sockaddr_storage\r\n> that instead.\r\n\r\nWe use wsdd for the address `#define WSDD_MULTICAST_IP \"239.255.255.250\"`\r\nThis is **IPv4** and we use the `AF_INET` type and `struct sockaddr_in`"}}
{"actor":{"display_login":"KoynovStas"}}