Alexey Serbin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/19244 )

Change subject: [build] mute some build complains
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

http://gerrit.cloudera.org:8080/#/c/19244/1/src/kudu/gutil/strings/util.cc
File src/kudu/gutil/strings/util.cc:

http://gerrit.cloudera.org:8080/#/c/19244/1/src/kudu/gutil/strings/util.cc@692
PS1, Line 692:   memcpy(result, the_string, max_length);
             :   return result;
I don't think it's a good idea.  We need to keep strncpy() since we don't want 
to copy all the max_lenght, just up to first NULL character.

I guess the issue that compiler was pointing at the following issue as 
described in 'man strncpy':

If stpncpy() does not terminate dst with a NUL character, it instead returns a 
pointer to dst[n] (which does not necessarily refer to a valid memory location.)

So, instead we need to just do 'return result;' and be done with that.



--
To view, visit http://gerrit.cloudera.org:8080/19244
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I690a27d6afdad00a57587892cacc2ad245a7d342
Gerrit-Change-Number: 19244
Gerrit-PatchSet: 1
Gerrit-Owner: Yingchun Lai <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Mon, 14 Nov 2022 19:56:32 +0000
Gerrit-HasComments: Yes

Reply via email to