Skip to content

Commit

Permalink
mitigate gcc8 -Werror=stringop-truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
toanju committed Feb 14, 2019
1 parent 103905f commit 97252b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) {
req->has_initial_request = true;
req->initial_request.has_name = true;
strncpy(req->initial_request.name, lb_service_name,
GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH);
GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH - 1);
req->initial_request.name[GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH - 1] = '\0';
return req;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ xds_grpclb_request* xds_grpclb_request_create(const char* lb_service_name) {
req->has_initial_request = true;
req->initial_request.has_name = true;
strncpy(req->initial_request.name, lb_service_name,
XDS_SERVICE_NAME_MAX_LENGTH);
XDS_SERVICE_NAME_MAX_LENGTH-1);
return req;
}

Expand Down

0 comments on commit 97252b2

Please sign in to comment.