Forráskód Böngészése

get rid of the trailing null in path

yang-g 8 éve
szülő
commit
c9f4bf9fcd
1 módosított fájl, 1 hozzáadás és 4 törlés
  1. 1 4
      src/core/lib/channel/http_client_filter.c

+ 1 - 4
src/core/lib/channel/http_client_filter.c

@@ -341,11 +341,8 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx,
         /* remove trailing unused memory and add trailing 0 to terminate string
          */
         char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice);
-        /* safe to use strlen since base64_encode will always add '\0' */
-        size_t path_length = strlen(t) + 1;
-        *(t + path_length) = '\0';
         path_with_query_slice =
-            grpc_slice_sub(path_with_query_slice, 0, path_length);
+            grpc_slice_sub(path_with_query_slice, 0, strlen(t));
 
         /* substitute previous path with the new path+query */
         grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices(