summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-08-07 11:55:22 +0200
committerSebastian Dransfeld <sebastian.dransfeld@sintef.no>2013-08-07 13:02:54 +0200
commit144ed4c10c3e73fb35b4a875377d5793e34201ee (patch)
treeab0972fc2177e9d37ab6e6e593ba6c0850304faf
parente011d5e67cef7d953f72f15950655c79331468c6 (diff)
efreet: Fix buffer overrun, leave space for '\0'
CID: #1039304, #1039305 and #1039306
Diffstat (limited to '')
-rw-r--r--src/lib/efreet/efreet_uri.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/efreet/efreet_uri.c b/src/lib/efreet/efreet_uri.c
index 20ebe391b0..236f7e519c 100644
--- a/src/lib/efreet/efreet_uri.c
+++ b/src/lib/efreet/efreet_uri.c
@@ -38,7 +38,7 @@ efreet_uri_decode(const char *full_uri)
38 38
39 /* parse protocol */ 39 /* parse protocol */
40 p = full_uri; 40 p = full_uri;
41 for (i = 0; *p != ':' && *p != '\0' && i < 64; p++, i++) 41 for (i = 0; *p != ':' && *p != '\0' && i < (64 - 1); p++, i++)
42 protocol[i] = *p; 42 protocol[i] = *p;
43 protocol[i] = '\0'; 43 protocol[i] = '\0';
44 44
@@ -46,7 +46,7 @@ efreet_uri_decode(const char *full_uri)
46 p += 3; 46 p += 3;
47 if (*p != '/') 47 if (*p != '/')
48 { 48 {
49 for (i = 0; *p != '/' && *p != '\0' && i < _POSIX_HOST_NAME_MAX; p++, i++) 49 for (i = 0; *p != '/' && *p != '\0' && i < (_POSIX_HOST_NAME_MAX - 1); p++, i++)
50 hostname[i] = *p; 50 hostname[i] = *p;
51 hostname[i] = '\0'; 51 hostname[i] = '\0';
52 } 52 }
@@ -55,7 +55,7 @@ efreet_uri_decode(const char *full_uri)
55 55
56 /* parse path */ 56 /* parse path */
57 /* See http://www.faqs.org/rfcs/rfc1738.html for the escaped chars */ 57 /* See http://www.faqs.org/rfcs/rfc1738.html for the escaped chars */
58 for (i = 0; *p != '\0' && i < PATH_MAX; i++, p++) 58 for (i = 0; *p != '\0' && i < (PATH_MAX - 1); i++, p++)
59 { 59 {
60 if (*p == '%') 60 if (*p == '%')
61 { 61 {