Discussion:
[PATCH v3 2/3] test: replace strncat() by strcat() to fix crypt warnings
geraldo netto
2018-11-06 03:11:23 UTC
Permalink
this patch fixes the following warnings:
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c: In function ‘concat_str’:
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c:9:34: warning: argument to ‘sizeof’ in ‘strncat’ call is the same expression as the source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
strncat(tmp, first_block, sizeof(first_block));
^
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c:10:35: warning: argument to ‘sizeof’ in ‘strncat’ call is the same expression as the source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
strncat(tmp, second_block, sizeof(second_block));
^

Signed-off-by: geraldo netto <***@gmail.com>
---
tests/tst-crypt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/tst-crypt.c b/tests/tst-crypt.c
index 7ccc8235..19aae269 100644
--- a/tests/tst-crypt.c
+++ b/tests/tst-crypt.c
@@ -8,8 +8,8 @@
char* concat_str(char* first_block, char* second_block) {
static char tmp[10];
memset(tmp, 0, sizeof(tmp));
- strncat(tmp, first_block, sizeof(first_block));
- strncat(tmp, second_block, sizeof(second_block));
+ strcat(tmp, first_block);
+ strcat(tmp, second_block);
return tmp;
}
--
2.17.1
--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Commit Bot
2018-11-06 06:17:50 UTC
Permalink
From: geraldo netto <***@gmail.com>
Committer: Waldemar Kozaczuk <***@gmail.com>
Branch: master

test: replace strncat() by strcat() to fix crypt warnings

this patch fixes the following warnings:
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c: In function
‘concat_str’:
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c:9:34: warning:
argument to ‘sizeof’ in ‘strncat’ call is the same expression as the
source; did you mean to provide an explicit length?
[-Wsizeof-pointer-memaccess]
strncat(tmp, first_block, sizeof(first_block));
^
/home/netto/Desktop/osv/osv-tomcat9/tests/tst-crypt.c:10:35: warning:
argument to ‘sizeof’ in ‘strncat’ call is the same expression as the
source; did you mean to provide an explicit length?
[-Wsizeof-pointer-memaccess]
strncat(tmp, second_block, sizeof(second_block));
^

Signed-off-by: geraldo netto <***@gmail.com>
Message-Id: <20181106031123.14062-1-***@gmail.com>

---
diff --git a/tests/tst-crypt.c b/tests/tst-crypt.c
--- a/tests/tst-crypt.c
+++ b/tests/tst-crypt.c
@@ -8,8 +8,8 @@
char* concat_str(char* first_block, char* second_block) {
static char tmp[10];
memset(tmp, 0, sizeof(tmp));
- strncat(tmp, first_block, sizeof(first_block));
- strncat(tmp, second_block, sizeof(second_block));
+ strcat(tmp, first_block);
+ strcat(tmp, second_block);
return tmp;
}
--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...