,
Aschref Ben Thabet
Embedded Brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
From: Aschref Ben Thabet
Strncpy() is unsafe if the terminating NUL is missing. Replace it by the
safer strlcpy() and fix the string truncation warning,since the
strlcpy() function returns the total length of the string it tried to
create,that means: the length of src.
---
bsps/shared/dev
From: Aschref Ben Thabet
Cast to (void *) to silence the warning.
---
cpukit/include/rtems/printer.h | 4
1 file changed, 4 deletions(-)
diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h
index 310937cc2f..25c6f27960 100644
--- a/cpukit/include/rtems/printer.h
From: Aschref Ben Thabet
Replace strncpy() with memcpy() to guarantee a safe copying of
characters.
---
cpukit/libblock/src/bdpart-mount.c | 14 ++
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/cpukit/libblock/src/bdpart-mount.c
b/cpukit/libblock/src/bdpart-mount.c
From: Aschref Ben Thabet
Replace strncpy() with memcpy() to guarantee a safe copying of
characters.
---
cpukit/libblock/src/bdpart-register.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpukit/libblock/src/bdpart-register.c
b/cpukit/libblock/src/bdpart-register.c
index
From: Aschref Ben Thabet
---
cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
index 39e70bffec..d2b412ceb0 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b
From: Aschref Ben Thabet
Strncpy() is considered unsafe as the resulting string may not be NULL
terminated. In addition it fills the unused part of the destination
buffer unnecessarily with NULL bytes.
Strlcpy() is designed to solve the null-termination problemsi,it always
null-terminates.
It’s
From: Aschref Ben Thabet
Taking care of the size of buffer to be copied and replace the unsafe
snprintf() with memcpy().
The reason why we get a warning on sprintf() is because memcpy() has a
length parameter that limits how much memory you copy.
For memcpy(), the input has to be terminated
From: Aschref Ben Thabet
Replace the unsafe function strcpy() with memmove() to avoid the string
restrict warning.
Since memmove() function is used to copy a specified number of bytes
from one memory to another or to overlap on same memory.
---
cpukit/libmisc/shell/shell.c | 10 +-
1
From: Aschref Ben Thabet
Replace the snprintf() code line with memcpy() and strcpy(). First copy
the MOUNT_DIR to dirname and add the '/' character, then copy the
invalide directory name.
---
testsuites/fstests/fsdosfsname01/init.c | 11 ---
1 file changed, 4 insertions(+), 7 deletions
From: Aschref Ben Thabet
Add a prototype for the function rtems_main_o5() to avoid the prototype
missing warning.
---
testsuites/libtests/dl10/dl10-o6.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testsuites/libtests/dl10/dl10-o6.c
b/testsuites/libtests/dl10/dl10-o6.c
From: Aschref Ben Thabet
Change the function ctrace_task_name_add() to take the variable name as
a value instead a pointer.
It avoids the warning and solve the issue.
---
cpukit/libmisc/capture/capture_support.c | 8
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cpukit
From: Aschref Ben Thabet
Replace strncpy() with strdup() to silence this warning since it tries
to allocate enough memory to hold the old string (plus a '\0' character
to mark the end of the string).
---
testsuites/psxtests/psxndbm01/init.c | 11 +++
1 file changed, 3 insertions(+), 8
From: Aschref Ben Thabet
Replace strcpy with the safer memcpy().
The strcpy() function is designed to work exclusively with strings.
strcpy() copies each byte of the source string to the destination string
and stops when the terminating null character (\0) has been moved.
On the other hand
From: Aschref Ben Thabet
strncpy is considered unsafe as the resulting string may not be NULL
terminated. In addition it fills the unused part of the destination
buffer unnecessarily with NULL bytes.
strlcpy is designed to solve the null-termination problems – it always
null-terminates. It’s
From: Aschref Ben Thabet
strncpy is unsafe if the terminating NULL is missing, as it may copy
more characters than fit in the destination area
Replace it by the safer strlcpy() and fix the string
turncation warnings.
---
bsps/shared/dev/display/disp_hcms29xx.c | 3 +--
1 file changed, 1
From: Aschref Ben Thabet
Add a prototype for the function rtems_main_o5 to avoid the prototype
missing warning.
---
testsuites/libtests/dl10/dl10-o6.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testsuites/libtests/dl10/dl10-o6.c
b/testsuites/libtests/dl10/dl10-o6.c
From: Aschref Ben Thabet
Add a prototxpe for the function rtems_main_o5 to avoid the prototype
missing warning.
---
testsuites/libtests/dl10/dl10-o6.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testsuites/libtests/dl10/dl10-o6.c
b/testsuites/libtests/dl10/dl10-o6.c
From: Aschref Ben Thabet
Key_ID array must have the right size, it shall have a value greater
than zero.
Note: In Standard C and C++, zero-size array is not
allowed..
---
testsuites/psxtests/psxkey01/system.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuites
From: Aschref Ben Thabet
The argument to the ctype functions must be an int and the value of the
character must be representable as an unsigned char or equal to the
value of the macro EOF. If the argument has any other value, the
behavior is undefined.
---
cpukit/libdl/rtl-archive.c
From: Aschref Ben Thabet
replace strncpy with strdup to silence this warning since it tries to
allocate enough memory to hold the old string (plus a '\0' character
to mark the end of the string).
---
testsuites/psxtests/psxndbm01/init.c | 5 +
1 file changed, 1 insertion(+), 4 deletions
Sorry it was not against master !
i send then V3 for this patch.
On 8/13/20 5:19 PM, Aschref Ben-Thabet wrote:
From: Aschref Ben Thabet
Using FILENAME_MAX as a parameter in strncpy function can gererate
warnings of type: -Wstringop-truncation. Replacing it with sizeof
(distination_buffer) can
From: Aschref Ben Thabet
Using FILENAME_MAX as a parameter in strncpy function can gererate
warnings of type: -Wstringop-truncation. Replacing it with sizeof
(distination_buffer) can avoid this warning.
---
cpukit/libmisc/shell/main_edit.c | 9 +
1 file changed, 5 insertions(+), 4
From: Aschref Ben Thabet
Using FILENAME_MAX as a parameter in strncpy function can gererate
warnings of type: -Wstringop-truncation. Replacing it with sizeof
(distination_buffer) can avoid this warning.
---
cpukit/libmisc/shell/main_edit.c | 11 ++-
1 file changed, 6 insertions(+), 5
From: Aschref Ben Thabet
replace strncpy with strdup to silence this warning since it tries to
allocate enough memory to hold the old string (plus a '\0' character
to mark the end of the string).
ddd
---
testsuites/psxtests/psxndbm01/init.c | 5 +
1 file changed, 1 insertion(+), 4
From: Aschref Ben Thabet
replace strncpy with strdup to silence this warning since it tries to
allocate enough memory to hold the old string (plus a '\0' character
to mark the end of the string).
---
testsuites/psxtests/psxndbm01/init.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions
t 7:03 AM Joel Sherrill mailto:j...@rtems.org>> wrote:
>
>
>
> On Wed, Aug 12, 2020 at 7:07 AM Aschref Ben-Thabet
mailto:aschref.ben-tha...@embedded-brains.de>> wrote:
>>
>> From: Aschref Ben Thabet mailto:aschref.ben-tha...
From: Aschref Ben Thabet
replace strncpy with memcpy to silence this warning and free the
allocated memory block.
---
testsuites/psxtests/psxndbm01/init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testsuites/psxtests/psxndbm01/init.c
b/testsuites/psxtests/psxndbm01
From: Aschref Ben Thabet
---
cpukit/include/rtems/printer.h | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h
index dbd887221e..310937cc2f 100644
--- a/cpukit/include/rtems/printer.h
+++ b/cpukit/include
From: Aschref Ben Thabet
---
v2:
Removed double blank line.
testsuites/libtests/dl10/dl-load.c | 22 --
1 file changed, 22 deletions(-)
diff --git a/testsuites/libtests/dl10/dl-load.c
b/testsuites/libtests/dl10/dl-load.c
index dee1d6e9cc..7a4bae9c17 100644
From: Aschref Ben Thabet
Since we need to test the strncpy function, using a character array with
a fixed array size in this case in place of character pointer can avoid
the string turncation warning.
---
testsuites/psxtests/psxhdrs/string/stpncpy.c | 7 +++
testsuites/psxtests/psxhdrs
From: Aschref Ben Thabet
the functions dl_close and dl_call are not needed for this test,
deleting them will avoid the warning of Wunused-function.
---
testsuites/libtests/dl10/dl-load.c | 21 -
1 file changed, 21 deletions(-)
diff --git a/testsuites/libtests/dl10/dl
From: Aschref Ben Thabet
since we need to test the strncpy function, using a character array with
a fixed array size in this case in place of character pointer can avoid
the string turncation warning.
---
testsuites/psxtests/psxhdrs/string/stpncpy.c | 8
testsuites/psxtests/psxhdrs
", func);
return1;
}
call ();
return0;
}
Beste regards
Aschref Ben thabet
Embedded Brains GmbH
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel
From: Aschref Ben Thabet
The warning may be because you're passing a char to the isspace() macro.
The implementation of isspace() may be via array indexing.
This means that the index for the array can be negative.
This can be a problem as a char could represent a signed value, and you
may
From: Aschref Ben Thabet
The warning may be because you're passing a char to the isspace() macro.
The implementation of isspace() may be via array indexing.
(The argument to the isspace()/isdegit() macro is defined to be an
unsigned char the value of which can fit in an unsignedchar
From: Aschref Ben Thabet
---
cpukit/include/rtems/printer.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpukit/include/rtems/printer.h b/cpukit/include/rtems/printer.h
index dbd887221e..fc091ffda3 100644
--- a/cpukit/include/rtems/printer.h
+++ b/cpukit/include/rtems
From: Aschref Ben Thabet
---
testsuites/psxtests/psxhdrs/string/strncat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuites/psxtests/psxhdrs/string/strncat.c
b/testsuites/psxtests/psxhdrs/string/strncat.c
index 730a56cfa6..d872be3408 100644
--- a/testsuites
From: Aschref Ben Thabet
---
testsuites/psxtests/psxhdrs/string/strncat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuites/psxtests/psxhdrs/string/strncat.c
b/testsuites/psxtests/psxhdrs/string/strncat.c
index 730a56cfa6..d872be3408 100644
--- a/testsuites
From: Aschref Ben Thabet
GCC 10 warns about an overlapping using strncpy.
-> Replace some calls of strncpy with a memcpy to avoid this issue.
---
cpukit/libblock/src/bdpart-mount.c | 4 ++--
testsuites/psxtests/psxndbm01/init.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
d
From: Aschref Ben Thabet
The warning may be because you're passing a char to the isspace() macro. The
implementation of isspace() may be via array indexing. (The argument to the
isspace()/isdegit() macro is defined to be an unsigned char the value of which
can fit in an unsignedchar
From: Aschref Ben Thabet
The warning may be because you're passing a char to the isspace() macro. The
implementation of isspace() may be via array indexing. (The argument to the
isspace()/isdegit() macro is defined to be an unsigned char the value of which
can fit in an unsignedchar
From: Aschref Ben Thabet
at ctype.h in GNU libc, and while there's a complicated mess of macros and
functions, somewhere in the definition of isspace() there's an array being
indexed.
See if isspace((unsigned char) *str) gets rid of the warning.
The line array[c] is very likely a bug
---
testsuites/sptests/sp21/init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testsuites/sptests/sp21/init.c b/testsuites/sptests/sp21/init.c
index f44f2ba851..71abe467a9 100644
--- a/testsuites/sptests/sp21/init.c
+++ b/testsuites/sptests/sp21/init.c
@@ -7,6 +7,8 @@
*
44 matches
Mail list logo