dnl /* libudev version */
LIBUDEV_LT_CURRENT=2
-LIBUDEV_LT_REVISION=0
+LIBUDEV_LT_REVISION=1
LIBUDEV_LT_AGE=2
AC_SUBST(LIBUDEV_LT_CURRENT)
AC_SUBST(LIBUDEV_LT_REVISION)
return 0;
}
-size_t util_path_encode(char *s, size_t len)
+size_t util_path_encode(char *s, size_t size)
{
- char t[(len * 4)+1];
+ char t[(size * 4)+1];
size_t i, j;
- for (i = 0, j = 0; s[i] != '\0'; i++) {
+ for (i = 0, j = 0; s[i] != '\0' && i < size; i++) {
if (s[i] == '/') {
memcpy(&t[j], "\\x2f", 4);
j += 4;
j++;
}
}
- if (len == 0)
- return j;
- i = (j < len - 1) ? j : len - 1;
- memcpy(s, t, i);
- s[i] = '\0';
+ if (i >= size)
+ return 0;
+ if (j >= size)
+ return 0;
+ memcpy(s, t, j);
+ s[j] = '\0';
return j;
}
if (memcmp(&s[i], "\\x2f", 4) == 0) {
s[j] = '/';
i += 4;
- }else if (memcmp(&s[i], "\\x5c", 4) == 0) {
+ } else if (memcmp(&s[i], "\\x5c", 4) == 0) {
s[j] = '\\';
i += 4;
} else {