summaryrefslogtreecommitdiff
path: root/listing.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-10-20 11:52:43 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-11-01 22:17:31 -0700
commit2458580ac95c550217b3376c46eecb2cca646241 (patch)
tree20285050ebc21a8068e732b3ba2be31adc5579d8 /listing.c
parent3ed68e06cb45fb526b09e4c7b7c3d60de552b2b3 (diff)
downloadxorg-app-xkbcomp-2458580ac95c550217b3376c46eecb2cca646241.tar.gz
Convert remaining sprintf calls to snprintf
Most were fixed length or length checked anyway, this just saves time doublechecking that. (A few could be replaced by asprintf, but we don't have a copy guaranteed to be reachable from this program yet.) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Diffstat (limited to 'listing.c')
-rw-r--r--listing.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/listing.c b/listing.c
index 11de88a..c7f5ef8 100644
--- a/listing.c
+++ b/listing.c
@@ -302,18 +302,19 @@ AddDirectory(char *head, char *ptrn, char *rest, char *map)
{
char *tmp, *filename;
struct stat sbuf;
+ size_t tmpsize;
filename = FileName(file);
if (!filename || filename[0] == '.')
continue;
if (ptrn && (!XkbNameMatchesPattern(filename, ptrn)))
continue;
- tmp =
- (char *) uAlloc((head ? strlen(head) : 0) + strlen(filename) + 2);
+ tmpsize = (head ? strlen(head) : 0) + strlen(filename) + 2;
+ tmp = uAlloc(tmpsize);
if (!tmp)
continue;
- sprintf(tmp, "%s%s%s", (head ? head : ""), (head ? "/" : ""),
- filename);
+ snprintf(tmp, tmpsize, "%s%s%s",
+ (head ? head : ""), (head ? "/" : ""), filename);
if (stat(tmp, &sbuf) < 0)
{
uFree(tmp);