Explorar o código

[Pal/Linux-SGX] Fix undef behavior by initializing opt with const in get_sockopt()

Isaku Yamahata %!s(int64=5) %!d(string=hai) anos
pai
achega
f53c3afd95
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      Pal/src/host/Linux-SGX/sgx_enclave.c

+ 3 - 0
Pal/src/host/Linux-SGX/sgx_enclave.c

@@ -274,6 +274,9 @@ static int sock_getopt(int fd, struct sockopt * opt)
 {
     SGX_DBG(DBG_M, "sock_getopt (fd = %d, sockopt addr = %p) is not implemented \
             always returns 0\n", fd, opt);
+    /* initialize *opt with constant */
+    *opt = (struct sockopt){0};
+    opt->reuseaddr = 1;
     return 0;
 }