summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-10-28 21:18:46 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:05 -0800
commit6e6d732bac3c21cb85f8e998908f9b393630e5f8 (patch)
treebe0fb5e9e8f4e10af141e061f35e6f62b06d3181 /xkb
parente189dbb3e57d30eb96034d4ce9544ce7a93a371e (diff)
Convert strncpy/strncat to strlcpy/strlcat
As long as we're carrying around a compatibility copy in os/strl*.c, might as well use them. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/ddxLoad.c6
-rw-r--r--xkb/maprules.c3
-rw-r--r--xkb/xkbtext.c3
3 files changed, 4 insertions, 8 deletions
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 219d39c9a..196142318 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -263,8 +263,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n",buf);
if (nameRtrn) {
- strncpy(nameRtrn,keymap,nameRtrnLen);
- nameRtrn[nameRtrnLen-1]= '\0';
+ strlcpy(nameRtrn,keymap,nameRtrnLen);
}
free(buf);
#ifdef WIN32
@@ -322,8 +321,7 @@ FILE * file;
}
else file= NULL;
if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) {
- strncpy(fileNameRtrn,buf,fileNameRtrnLen);
- buf[fileNameRtrnLen-1]= '\0';
+ strlcpy(fileNameRtrn,buf,fileNameRtrnLen);
}
return file;
}
diff --git a/xkb/maprules.c b/xkb/maprules.c
index f94089982..a14fbbb2a 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -250,8 +250,7 @@ get_index(char *str, int *ndx)
*ndx = -1;
return end + 1;
}
- strncpy(ndx_buf, str, end - str);
- ndx_buf[end - str] = '\0';
+ strlcpy(ndx_buf, str, 1 + end - str);
*ndx = atoi(ndx_buf);
return end + 1;
}
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 9f49d59ff..1ba10a194 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -81,8 +81,7 @@ char *rtrn,*tmp;
if (len>BUFFER_SIZE)
len= BUFFER_SIZE-2;
rtrn= tbGetBuffer(len);
- strncpy(rtrn,atmstr,len);
- rtrn[len]= '\0';
+ strlcpy(rtrn,atmstr,len);
}
else {
rtrn= tbGetBuffer(1);