libosmocore[master]: pseudotalloc: Add poor implementation of talloc_asprintf

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Jun 21 13:43:30 UTC 2017


Patch Set 1: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/2961/1/src/pseudotalloc/pseudotalloc.c
File src/pseudotalloc/pseudotalloc.c:

Line 72: 	while (1) {
since this is for an embedded libosmocore, it doesn't make sense to allow any size of string. I would use a smaller len (64? 128?) and simply not enlarge, being fine with truncated strings. (When it was truncated, we could write '[...]' to the end of the buf to indicate truncation.)


Line 74: 		if (len < vsprintf(buf, fmt, args))
vsprintf() will write past the buffer's end! You have to use vsnprintf() with a size arg.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I61cd83d4c8570af1e452c945ac6f194baf7e6ac4
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list