From 3d4701a6e41616cf581a297bab1451cf2db70249 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Tue, 14 Jul 2009 13:57:45 +0000 Subject: FS#10080 * Move strncpy() from core to the pluginlib * Introduce strlcpy() and use that instead in most places (use memcpy in a few) in core and some plugins * Drop strncpy() from the codec api as no codec used it * Bump codec and plugin api versions git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21863 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/wps_parser.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'apps/gui/wps_parser.c') diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 09bcab8443..8ae83924c2 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -1489,8 +1489,7 @@ static bool wps_parse(struct wps_data *data, const char *wps_bufptr) break; } - strncpy(stringbuf, string_start, len); - *(stringbuf + len) = '\0'; + strlcpy(stringbuf, string_start, len+1); data->strings[data->num_strings] = stringbuf; stringbuf += len + 1; @@ -1781,11 +1780,9 @@ bool wps_data_load(struct wps_data *wps_data, #ifdef HAVE_LCD_BITMAP /* get the bitmap dir */ char bmpdir[MAX_PATH]; - size_t bmpdirlen; char *dot = strrchr(buf, '.'); - bmpdirlen = dot - buf; - strncpy(bmpdir, buf, dot - buf); - bmpdir[bmpdirlen] = 0; + + strlcpy(bmpdir, buf, dot - buf + 1); /* load the bitmaps that were found by the parsing */ if (!load_wps_bitmaps(wps_data, bmpdir)) { -- cgit v1.2.3