Displaying 20 results from an estimated 234 matches for "strnlen".
Did you mean:
strlen
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
Joerg Sonnenberger wrote:
> On Sat, Feb 06, 2016 at 11:05:14PM -0500, Michael McConville via llvm-dev wrote:
> > This addition converts strlen() calls to strnlen() when the result is
> > compared to a constant. For example, the following:
> >
> > strlen(s) < 5
> >
> > Becomes:
> >
> > strnlen(s, 5) < 5
> >
> > That way, we don't have to walk through the entire string. There is the
> >...
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
This addition converts strlen() calls to strnlen() when the result is
compared to a constant. For example, the following:
strlen(s) < 5
Becomes:
strnlen(s, 5) < 5
That way, we don't have to walk through the entire string. There is the
added overhead of maintaining a counter when using strnlen(), but I
thought I'd start with the...
2007 Apr 12
2
[PATCH] Make com32 printf obey width-restriction on %s
Hi,
The following patch is against 3.36. It lets the width-modifier to the
%s conversion specifier restrict the length of the formatted string as
well as expand it. In addition, it adds the strnlen function, which
only exists as a prototype today.
--
Arne.
--- syslinux-3.36/com32/lib/Makefile.orig 2007-02-10 21:47:07.000000000
+0100
+++ syslinux-3.36/com32/lib/Makefile 2007-04-12 12:06:07.000000000 +0200
@@ -11,7 +11,7 @@
perror.o printf.o puts.o qsort.o realloc.o seed48.o snpr...
2020 Mar 28
0
[klibc:update-dash] Implement stpcpy() and stpncpy()
...en:%zu strlen:%zu\n", temp, end - temp, strlen(temp));
+ if (end != temp + 7 || memcmp(temp, "1234567\0X", 10))
+ goto error;
+
+ printf("\n");
+ printf("stpncpy:\n");
+
+ clear_temp();
+ end = stpncpy(temp, "123", 8);
+ printf("'%s'len:%zu strnlen:%zu\n", temp, end - temp, strnlen(temp, 8));
+ if (end != temp + 3 || memcmp(temp, "123\0\0\0\0\0X", 10))
+ goto error;
+
+ clear_temp();
+ end = stpncpy(temp, "", 8);
+ printf("'%s'len:%zu strnlen:%zu\n", temp, end - temp, strnlen(temp, 8));
+ if (end !=...
2007 Sep 20
0
[patch]use strnlen to deal with string from user space
...661119092 inode.c
--- a/inode.c Mon Sep 17 11:25:58 2007 -0400
+++ b/inode.c Thu Sep 20 22:25:34 2007 +0800
@@ -1985,7 +1988,7 @@ static int btrfs_ioctl_snap_create(struc
if (copy_from_user(&vol_args, arg, sizeof(vol_args)))
return -EFAULT;
- namelen = strlen(vol_args.name);
+ namelen = strnlen(vol_args.name, BTRFS_VOL_NAME_MAX + 1);
if (namelen > BTRFS_VOL_NAME_MAX)
return -EINVAL;
if (strchr(vol_args.name, '/'))
2010 Aug 10
1
Why p_strdup and other string functions uses loops instead strlen? (dovecot 2.0.rc4)
...e-mail system, and p_strdup was very
high on list.
I do minor change:
p_strdup:
/*
for (len = 0; (str)[len] != '\0'; )
len++;
len++;
*/
len = strlen(str) + 1;
p_strndup:
/*
len = 0;
while (len < max_chars && ((const char *) str)[len] != '\0')
len++;
*/
len = strnlen(str, max_chars);
And after changes strdup drop down on the profile list.
This is output from oprofile:
samples % symbol name
28000 10.9764 p_strdup
8507 3.3349 safe_memset
7857 3.0801 .plt
7627 2.9899 buffer_write
6871 2.6935 parse_body_add_block
And after (...
2005 Mar 15
0
Compiling samba 3.0.12pre1 on AIX 4.3.3
...ng lib/dprintf.c
Compiling lib/xfile.c
Compiling lib/wins_srv.c
Compiling lib/util_str.c
lib/util_str.c: In function `strstr_m':
lib/util_str.c:1337: warning: return discards qualifiers from pointer
target type
lib/util_str.c: At top level:
lib/util_str.c:1560: error: conflicting types for 'strnlen'
lib/util_str.c:598: error: previous implicit declaration of 'strnlen'
was here
make: *** [lib/util_str.o] Error 1
bash-2.05b#
2018 Feb 25
0
Building llvm-5.0.1 on Solaris 10/sparc
.../nemo/opt/llvm/llvm-5.0.1.src/lib/ObjectYAML/MachOYAML.cpp: In
static member function 'static void llvm::yaml::ScalarTraits<char
[16]>::output(const char (&)[16], void*, llvm::raw_ostream&)':
/home/nemo/opt/llvm/llvm-5.0.1.src/lib/ObjectYAML/MachOYAML.cpp:40:33:
error: 'strnlen' was not declared in this scope
auto Len = strnlen(&Val[0], 16);
gmake[2]: ***
[lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/MachOYAML.cpp.o] Error 1
gmake[1]: *** [lib/ObjectYAML/CMakeFiles/LLVMObjectYAML.dir/all] Error 2
My main question is: Why are Mach0 tools being built?
Sincer...
2018 Mar 17
0
Successful Build: llvm-5.0.1 on Solaris 10/sparc
...ld/gcc/5.4.0/bin/gcc \
-DCMAKE_CXX_COMPILER=/home/build/gcc/5.4.0/bin/g++ \
-DLLVM_TARGETS_TO_BUILD=Sparc \
-DCMAKE_INSTALL_PREFIX=/home/build/llvm \
-DCMAKE_BUILD_TYPE=Release \
/home/build/opt/llvm/llvm-5.0.1.src
LD_OPTIONS="-z altexec64" gmake
A few problems arose:
1. Added code for strnlen to
llvm-5.0.1.src/tools/obj2yaml/macho2yaml.cpp and
llvm-5.0.1.src/lib/ObjectYAML/MachOYAML.cpp
(as strnlen() is not POSIX, hence not in <string.h>).
2. Changed grep-->ggrep in
bld.llvm-rel/tools/bugpoint-passes/CMakeFiles/BugpointPasses_exports.dir/build.make
(as "-q" is GNU...
2011 Jun 24
4
[PATCH 0/2] Correct various strndup() problems
The current implementation of strndup() has some shortcomings that can
lead to a fatal error.
- If we pass a maximum string length larger than the copied length, we
will corrupt some data beyond the end of the newly allocated buffer.
- The maximum length does not prevent access to memory beyond the
maximum length, which can lead to unexpectd errors with strings not
terminated by 0.
2009 Jan 19
4
[Patch] Btrfs: use BTRFS_VOL_NAME_MAX for struct btrfs_ioctl_vol_args
...;
struct btrfs_ioctl_clone_range_args {
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index db9fb3b..5facdbf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -593,7 +593,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
ret = -EFAULT;
goto out;
}
- len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
+ len = strnlen(vol->name, BTRFS_VOL_NAME_MAX);
switch (cmd) {
case BTRFS_IOC_SCAN_DEV:
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at htt...
2002 Jun 25
1
RE: [PATCH] smbfs readdir fix (CFT: NetApp, OS/2)
Can someone share the smbfs-2.4.19-pre9-readdir.patch.
-----Original Message-----
From: David.Lee@bisus.com [mailto:David.Lee@bisus.com]
Sent: Tuesday, June 25, 2002 4:21 PM
To: vlads@sympatico.ca; urban@teststation.com
Cc: samba@lists.samba.org; David.Lee@bisus.com
Subject: [Samba] RE: [PATCH] smbfs readdir fix (CFT: NetApp, OS/2)
Vlad.
I still got the same problem - 'ls | wc -l'
2016 Mar 22
2
GSoC and SAFECode
...GSoC doing security auditing for Pidgin/libpurple.
GSoC seems like a great way to spend this summer as well. I'm
particularly interested in the SAFECode project and LLVM's general
security and auditing features. I haven't worked a ton with LLVM in the
past, but I have a mostly finished strnlen(3) optimization I've been
meaning to resubmit:
https://marc.info/?l=llvm-commits&m=145485679322322&w=2
I also worked with Martin Natano to port the integer overflow checker to
OpenBSD and build a working kernel and userland with it. We now have a
patch that integrates it into the full...
2018 Mar 18
0
Wine release 2.0.5
...40866 DigitalMicrograph: crashes when a new script is added to the menu
40963 Upwards, lonely robot Demo crashes with Too many buffers queued
41209 The Magic School Bus Explores the Solar System: Error message asking for the game to be reinstalled
41220 Provide fallback implementation of strnlen for OS versions that don't have it in their Libc (Leopard, Snow Leopard, et al)
42307 Temple+: needs knownfolder_GetRedirectionCapabilities
42414 The Witcher 3 intro videos don't play
42570 dinput/tests/mouse intermittently fails in Acquire() and GetDeviceData()
43000 wine can...
2020 Aug 18
1
Re: [PATCH nbdkit 3/9] server: Add general replacements for missing functions using LIBOBJS.
...replacements/realpath.c
> new file mode 100644
> index 00000000..622ee7ea
> --- /dev/null
> +++ b/common/replacements/realpath.c
> +++ b/common/replacements/strndup.c
> +
> +char *
> +strndup(const char *s, size_t n)
> +{
> + size_t len = strlen (s);
You _must_ use strnlen here. Otherwise, a user that passes in a pointer
to bytes that are bounded by a memory page transition rather than a NUL
can cause you to SEGV reading beyond n bytes.
> + char *ret;
> +
> + if (len > n)
> + len = n;
and once you've used strnlen, this is dead.
> +
&g...
2011 Jun 21
0
builder-ubuntu libguestfs FAILED build step e1e78bcef5e4654bd2456bd696840329359d35cd
...stddef-tests
stdint
stdint-tests
stdio
stdio-tests
stdlib
stdlib-tests
strchrnul
strchrnul-tests
strdup-posix
streq
strerror
strerror-override
strerror-tests
strerror_r-posix
strerror_r-posix-tests
string
string-tests
strndup
strnlen
strnlen-tests
strnlen1
symlink
symlink-tests
symlinkat
symlinkat-tests
sys_ioctl
sys_ioctl-tests
sys_select
sys_select-tests
sys_socket
sys_socket-tests
sys_stat
sys_stat-tests
sys_time
sys_time-tests
sys_uio
sys_uio-tests
sys_wa...
2018 Jun 06
0
[PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations
...LINE char *strncpy(char *p, const
>char *q, __kernel_size_t size)
>include/linux/string.h:__FORTIFY_INLINE char *strcat(char *p, const
>char *q)
>include/linux/string.h:__FORTIFY_INLINE __kernel_size_t strlen(const
>char *p)
>include/linux/string.h:__FORTIFY_INLINE __kernel_size_t strnlen(const
>char *p, __kernel_size_t maxlen)
>include/linux/string.h:__FORTIFY_INLINE size_t strlcpy(char *p, const
>char *q, size_t size)
>include/linux/string.h:__FORTIFY_INLINE char *strncat(char *p, const
>char *q, __kernel_size_t count)
>include/linux/string.h:__FORTIFY_INLINE voi...
2005 Jan 06
0
[PATCH] memchr and memrchr
...suspend.o \
brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \
memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
- memmove.o memchr.o \
+ memmove.o memchr.o memrchr.o \
strcasecmp.o strncasecmp.o strndup.o strerror.o \
strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
strncat.o strlcpy.o strlcat.o \
--
Thayne Harbaugh
Linux Networx
2011 Aug 29
0
[PATCH] Add mempcpy() as wrapper around memcpy
...memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
+ memcpy.o mempcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
memmove.o memchr.o memrchr.o bzero.o \
strcasecmp.o strncasecmp.o strndup.o strerror.o strsignal.o \
strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
diff --git a/usr/klibc/mempcpy.c b/usr/klibc/mempcpy.c
new file mode 100644
index 0000000..ff3770a
--- /dev/null
+++ b/usr/klibc/mempcpy.c
@@ -0,0 +1,7 @@
+#include <string.h>
+
+void *mempcpy(void *dst, const void *src, size_t len)
+{
+ return (char *) memcpy(dst, src, len) + len;
+
+}
-...
2015 Jun 25
5
Call for testing: OpenSSH 6.9
On 01/06/15 22:17, Tom G. Christensen wrote:
> On sparc-sun-solaris2.6 and sparc-sun-solaris2.7 the testsuite fails:
> run test cfgparse.sh ...
> reparse minimal config
> reparse regress config
> listenaddress order
> bad addr or host: ::1 (no address associated with name)
> listenaddress order 1
> bad addr or host: ::1 (no address associated with name)
> listenaddress