Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/6319/2/src/libmsc/msc_mgcp.c
File src/libmsc/msc_mgcp.c:

Line 252:           MGCP_ENDPOINT_MAXLEN) {
While this code is correct because sizeof(mgcp_msg.endpoint) and 
MGCP_ENDPOINT_MAXLEN have the same value, I would stick to the idiom:

  if (strlcpy(dst, src, dstsize) >= dstsize)

So I'd use the exact same value for the dstsize argument and the truncation 
check, either sizeof(mgcp_msg.endpoint) or MGCP_ENDPOINT_MAXLEN, but would 
avoid mixing them.

The reason is just that this is a common idiom people auditing code will be 
looking for. Not obviously using the same value raises a red flag in a 
reviewer's mind.

See also the EXAMPLES section in http://man.openbsd.org/strlcpy


-- 
To view, visit https://gerrit.osmocom.org/6319
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperl...@sysmocom.de>
Gerrit-Reviewer: dexter <pma...@sysmocom.de>
Gerrit-HasComments: Yes

Reply via email to