summaryrefslogtreecommitdiff
path: root/backend/as6e.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
commit3dade5db2a37543f19f0967901d8d80a52a1e459 (patch)
tree808b2499b54563b3290f34d70d159b1024310873 /backend/as6e.c
parent5bb4cf12855ec0151de15d6c5a2354ff08766957 (diff)
parentffa8801644a7d53cc1c785e3450f794c07a14eb0 (diff)
Update upstream source from tag 'upstream/1.0.29'
Update to upstream version '1.0.29' with Debian dir 2d358af604988ebe4348e38096245d66036fe5ed
Diffstat (limited to 'backend/as6e.c')
-rw-r--r--backend/as6e.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/backend/as6e.c b/backend/as6e.c
index 37a6d3b..47d8c90 100644
--- a/backend/as6e.c
+++ b/backend/as6e.c
@@ -797,7 +797,6 @@ check_for_driver (const char *devname)
struct stat statbuf;
mode_t modes;
char *path;
- char fullname[NAMESIZE];
char dir[NAMESIZE];
int count = 0, offset = 0, valid;
@@ -806,7 +805,6 @@ check_for_driver (const char *devname)
return 0;
while (path[count] != '\0')
{
- memset (fullname, '\0', sizeof (fullname));
memset (dir, '\0', sizeof (dir));
valid = 1;
while ((path[count] != ':') && (path[count] != '\0'))
@@ -819,19 +817,19 @@ check_for_driver (const char *devname)
count++;
}
if (valid == 1)
- {
- /* use sizeof(fullname)-1 to make sure there is at least one padded null byte */
- strncpy (fullname, dir, sizeof(fullname)-1);
- /* take into account that fullname already contains non-null bytes */
- strncat (fullname, "/", sizeof(fullname)-strlen(fullname)-1);
- strncat (fullname, devname, sizeof(fullname)-strlen(fullname)-1);
- if (!stat (fullname, &statbuf))
- {
- modes = statbuf.st_mode;
- if (S_ISREG (modes))
- return (1); /* found as6edriver */
- }
- }
+ {
+ char fullname[NAMESIZE];
+ int len = snprintf(fullname, sizeof(fullname), "%s/%s", dir, devname);
+ if ((len > 0) && (len <= (int)sizeof(fullname)))
+ {
+ if (!stat (fullname, &statbuf))
+ {
+ modes = statbuf.st_mode;
+ if (S_ISREG (modes))
+ return (1); /* found as6edriver */
+ }
+ }
+ }
if (path[count] == '\0')
return (0); /* end of path --no driver found */
count++;