osmo-bsc[master]: abisip-find: add getopts and option to prevent endless loop

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Dec 13 20:26:56 UTC 2017


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/5239/2/src/ipaccess/abisip-find.c
File src/ipaccess/abisip-find.c:

Line 210: 	strncpy(program_name, basename(argv[0]), sizeof(program_name));
you don't need  to copy the string here, as the argc array is pushed on the stack before main() is called. This means it is valid until you return from main, and hence a "char *program_name = basename(argv[0]) is sufficient.  basename *modifies* argv[0] and doesn't create any copies itself.

Also, *if* you want to do a string-copy, please *always* use osmo_strlcpy() everywhere to make sure we properly NUL-terminate the buffer in all situations, thanks.

Also, *if* you want to use a static-sized buffer, it's best to use PATH_MAX rather than the magic number 255, as PATH_MAX is as long as the maximum name of a file system path.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I819b9616282dd6efd36c9557c7d6a50b6b00cdc2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list