chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
split udev_util in several files
[elogind.git]
/
udev_libc_wrapper.c
diff --git
a/udev_libc_wrapper.c
b/udev_libc_wrapper.c
index d69f2ac48e11dfb0dcc01daa6125089697307b93..4e9f9f1fe87108625ae539fbf4823a8a1b061ed4 100644
(file)
--- a/
udev_libc_wrapper.c
+++ b/
udev_libc_wrapper.c
@@
-58,8
+58,10
@@
size_t strlcpy(char *dst, const char *src, size_t size)
bytes++;
}
bytes++;
}
+ /* If size == 0 there is no space for a final null... */
if (size)
*q = '\0';
if (size)
*q = '\0';
+
return bytes;
}
return bytes;
}
@@
-83,8
+85,7
@@
size_t strlcat(char *dst, const char *src, size_t size)
bytes++;
}
bytes++;
}
- if (size)
- *q = '\0';
+ *q = '\0';
return bytes;
}
#endif /* __OWN_STRLCPYCAT__ */
return bytes;
}
#endif /* __OWN_STRLCPYCAT__ */
@@
-158,7
+159,8
@@
static unsigned long get_id_by_name(const char *uname, const char *dbfile)
if (count >= sizeof(line))
continue;
if (count >= sizeof(line))
continue;
- strlcpy(line, bufline, count);
+ memcpy(line, bufline, count-1);
+ line[count-1] = '\0';
pos = line;
/* get name */
pos = line;
/* get name */