From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Thu, 13 Oct 2011 19:01:48 -0400 Subject: [U-Boot] [PATCH v3 6/6] fdt: add decode helper library In-Reply-To: References: <1318371971-4457-1-git-send-email-sjg@chromium.org> <201110131633.25542.vapier@gentoo.org> Message-ID: <201110131901.50980.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 13 October 2011 17:28:10 Simon Glass wrote: > On Thu, Oct 13, 2011 at 1:33 PM, Mike Frysinger wrote: > > On Tuesday 11 October 2011 18:26:11 Simon Glass wrote: > >> +int fdtdec_next_alias(const void *blob, const char *name, > >> + enum fdt_compat_id id, int *upto) > >> +{ > >> +#define MAX_STR_LEN 20 > >> + char str[MAX_STR_LEN + 20]; > >> + int node, err; > >> + > >> + sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); > > > > where's that "20" coming from ? just arbitrarily defined ? might want > > to add an assert(strlen(name) <= MAX_STR_LEN). > > OK. Of course I would like to use snprintf()... i think that might be nicer anyways than %.*s char str[40]; /* an arbitrary len */ snprintf(str, sizeof(str), "%s%d", name, *upto); -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20111013/0f112de4/attachment.pgp