aboutsummaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
authorMukesh Ojha <mukesh02@linux.vnet.ibm.com>2016-09-02 10:26:39 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-11 15:40:30 +1100
commit32dc2a19bb6a91862b414fdd6eec07154e5e4308 (patch)
tree4de14dfaf6180b4a7c494c9e5a9dee230d7c11ed /libc/string
parentedf57684bd6821d4d01515b6e599f477e04ca01d (diff)
downloadskiboot-32dc2a19bb6a91862b414fdd6eec07154e5e4308.zip
skiboot-32dc2a19bb6a91862b414fdd6eec07154e5e4308.tar.gz
skiboot-32dc2a19bb6a91862b414fdd6eec07154e5e4308.tar.bz2
libc : Changes variable data type where return value of strlen() stored from int to size_t
Reason of the change as integer value may overflow, and it can give negative value for the length. This patch also changes the data type of variable which is compared with strlen() as the comparison also has to be done on the same level. Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/strcat.c2
-rw-r--r--libc/string/strstr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libc/string/strcat.c b/libc/string/strcat.c
index eb597a0..936e5b1 100644
--- a/libc/string/strcat.c
+++ b/libc/string/strcat.c
@@ -15,7 +15,7 @@
char *
strcat(char *dst, const char *src)
{
- int p;
+ size_t p;
p = strlen(dst);
strcpy(&dst[p], src);
diff --git a/libc/string/strstr.c b/libc/string/strstr.c
index 3e090d2..a6e9618 100644
--- a/libc/string/strstr.c
+++ b/libc/string/strstr.c
@@ -16,7 +16,7 @@ char *
strstr(const char *hay, const char *needle)
{
char *pos;
- int hlen, nlen;
+ size_t hlen, nlen;
if (hay == NULL || needle == NULL)
return NULL;