Explorar o código

[FIX] fix potential webclient_resolve_address crash when getaddrinfo failed (#91)

Co-authored-by: shangjinlong <shangjinlong@agora.io>
shangjinlong %!s(int64=3) %!d(string=hai) anos
pai
achega
3d2bbafc98
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/webclient.c

+ 2 - 0
src/webclient.c

@@ -178,6 +178,8 @@ static int webclient_resolve_address(struct webclient_session *session, struct a
     RT_ASSERT(res);
     RT_ASSERT(request);
 
+    /* make sure *res = NULL before getaddrinfo */
+    *res = RT_NULL;
     url_len = rt_strlen(url);
 
     /* strip protocol(http or https) */