search for: strto

Displaying 20 results from an estimated 22 matches for "strto".

Did you mean: strtod
2016 Jul 05
3
[PATCH v2 0/7] lib: string: add functions to case-convert strings
...tions: >> char *strncpytoupper(char *dst, const char *src, size_t len); >> char *strncpytolower(char *dst, const char *src, size_t len); >> char *strcpytoupper(char *dst, const char *src); >> char *strcpytolower(char *dst, const char *src); >> char *strtoupper(char *s); >> char *strtolower(char *s); > > I think there isn't much value in anything other > than strto<upper|lower>. > > Using str[n]cpy followed by strto<upper|lower> is > pretty obvious and rarely used anyway. First time around, folks were prop...
2020 May 22
6
RFC: *scanf vs. overflow
...as long been known that the C specification of *scanf() leaves behavior undefined for things like int i; sscanf("9999999999999999", "%i", &i); C11 7.21.6.2 P12 "Matches an optionally signed integer, whose format is the same as expected for the subject sequence of the strtol function with the value 0 for the base argument." C11 7.21.6.2 P10 "If this object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined." as there is an overflow when consuming the input which matche...
2016 Jul 05
0
[PATCH v2 0/7] lib: string: add functions to case-convert strings
...*strncpytoupper(char *dst, const char *src, size_t len); > > >     char *strncpytolower(char *dst, const char *src, size_t len); > > >     char *strcpytoupper(char *dst, const char *src); > > >     char *strcpytolower(char *dst, const char *src); > > >     char *strtoupper(char *s); > > >     char *strtolower(char *s); > > I think there isn't much value in anything other > > than strto. > > > > Using str[n]cpy followed by strto is > > pretty obvious and rarely used anyway. > First time around, folks were proposing t...
2016 Jul 05
7
[PATCH v2 0/7] lib: string: add functions to case-convert strings
...Consequently, I am proposing these new functions: char *strncpytoupper(char *dst, const char *src, size_t len); char *strncpytolower(char *dst, const char *src, size_t len); char *strcpytoupper(char *dst, const char *src); char *strcpytolower(char *dst, const char *src); char *strtoupper(char *s); char *strtolower(char *s); They all return a pointer to the terminating '\0' in the destination string (for strtoupper() and strtolower() that is "s"). Several drivers are being modified to make use of the functions above. Another driver that also makes use of...
2016 Jul 05
0
[PATCH v2 0/7] lib: string: add functions to case-convert strings
...osing these new functions: >     char *strncpytoupper(char *dst, const char *src, size_t len); >     char *strncpytolower(char *dst, const char *src, size_t len); >     char *strcpytoupper(char *dst, const char *src); >     char *strcpytolower(char *dst, const char *src); >     char *strtoupper(char *s); >     char *strtolower(char *s); I think there isn't much value in anything other than strto<upper|lower>. Using str[n]cpy followed by strto<upper|lower> is pretty obvious and rarely used anyway.
2020 May 23
0
Re: RFC: *scanf vs. overflow
...81f64f7f182c20fa3dc/plugins/data/format.c#L171-L172 https://github.com/libguestfs/nbdkit/blob/b23f4f53cf71326f1dba481f64f7f182c20fa3dc/filters/ddrescue/ddrescue.c#L98 We can only do this safely where we can prove that overflow does not matter. In other cases we've had to change sscanf uses to strto* etc which is much more difficult to use correctly. Just look at how much code is required to wrap strto* functions to use them safely: https://github.com/libguestfs/nbdkit/blob/b23f4f53cf71326f1dba481f64f7f182c20fa3dc/server/public.c#L113-L296 Rich. -- Richard Jones, Virtualization Group, Red...
2020 May 23
0
Re: RFC: *scanf vs. overflow
On Sat, May 23, 2020 at 09:28:26AM -0700, Paul Eggert wrote: > On 5/23/20 9:11 AM, Rich Felker wrote: > > > stopping on an initial prefix ... does not admit easily sharing a backend with strto*. > > I don't see why. If the backend has a "stop scanning on integer overflow" flag > (which it would need to have anyway, to support the proposed behavior), then > *scanf can use the flag and strto* can not use it. > > Anyway, this is not an issue for glibc, whic...
2016 Jul 09
2
[PATCH v3 1/7] lib: string: add functions to case-convert strings
...gt; > The new functions are > void strlcpytoupper(char *dst, const char *src, size_t len); > void strlcpytolower(char *dst, const char *src, size_t len); > void strcpytoupper(char *dst, const char *src); > void strcpytolower(char *dst, const char *src); > void strtoupper(char *s); > void strtolower(char *s); > > The "str[l]cpyto*" versions of the function take a destination string > and a source string as arguments. The "strlcpyto*" versions additionally > take a length argument like strlcpy() itself. Lastly, the strto*...
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
On 9/21/19 6:56 AM, Richard W.M. Jones wrote: > sscanf is sadly not safe (because it doesn't handle integer overflow > correctly), and strto*l functions are a pain to use correctly. > Therefore add some functions to hide the pain of parsing integers from > the command line. > > The simpler uses of sscanf and strto*l are replaced. There are still > a few where we are using advanced features of sscanf. I note you are not...
2016 Aug 10
3
[PATCH v5 0/7] lib: string: add functions to case-convert strings
...sed in) Consequently, I am proposing these new functions: int strlcpytoupper(char *dst, const char *src, size_t len); int strlcpytolower(char *dst, const char *src, size_t len); void strcpytoupper(char *dst, const char *src); void strcpytolower(char *dst, const char *src); void strtoupper(char *s); void strtolower(char *s); Several drivers are being modified to make use of the functions above. Another driver that also makes use of this functionality will be submitted upstream shortly, which prompted this whole exercise. The changes made here have been compile-tested, but...
2016 Jul 22
3
[PATCH v4 0/7] lib: string: add functions to case-convert strings
...sed in) Consequently, I am proposing these new functions: int strlcpytoupper(char *dst, const char *src, size_t len); int strlcpytolower(char *dst, const char *src, size_t len); void strcpytoupper(char *dst, const char *src); void strcpytolower(char *dst, const char *src); void strtoupper(char *s); void strtolower(char *s); Several drivers are being modified to make use of the functions above. Another driver that also makes use of this functionality will be submitted upstream shortly, which prompted this whole exercise. The changes made here have been compile-tested, but...
2020 May 23
0
Re: RFC: *scanf vs. overflow
...ntually get POSIX to standardize this behavior. I'm not really a fan of stopping on an initial prefix. While UB allows anything, that's contrary to the abstract behavior defined for scanf (matching fields syntactically then value conversion) and does not admit easily sharing a backend with strto*. It's also even *more likely* to break programs that don't expect the behavior than just storing a wrapped or clamped value, since all the remaining fields will misalign with the conversion specifier string. FILE-based (as opposed to string-based) scanf forms inherently do not admit any k...
2012 May 10
0
Windows Server 2008R2 WDS workaround and pxechn.c32 status
...onse is received (in which case the boot server is in packet #3). When performing a PXE restart (as with pxechain.com), normally only packet #3 is altered. This results in wdsnbp.com asking the wrong server for information. pxechn.c32 can set any DHCP option with the input as an integer parsed by strto*(), hex bytes or a character string. It also has a wait option and 3 options to make adjusting the PXELINUX DHCP options easier. Currently, it's waiting on a function set not currently present in the tree and final review. -- -Gene
2016 Jul 08
0
[PATCH v3 1/7] lib: string: add functions to case-convert strings
...t reducing this code duplication. The new functions are void strlcpytoupper(char *dst, const char *src, size_t len); void strlcpytolower(char *dst, const char *src, size_t len); void strcpytoupper(char *dst, const char *src); void strcpytolower(char *dst, const char *src); void strtoupper(char *s); void strtolower(char *s); The "str[l]cpyto*" versions of the function take a destination string and a source string as arguments. The "strlcpyto*" versions additionally take a length argument like strlcpy() itself. Lastly, the strto* functions take a single s...
2016 Jul 09
0
[PATCH v3 1/7] lib: string: add functions to case-convert strings
...nctions are >> void strlcpytoupper(char *dst, const char *src, size_t len); >> void strlcpytolower(char *dst, const char *src, size_t len); >> void strcpytoupper(char *dst, const char *src); >> void strcpytolower(char *dst, const char *src); >> void strtoupper(char *s); >> void strtolower(char *s); >> >> The "str[l]cpyto*" versions of the function take a destination string >> and a source string as arguments. The "strlcpyto*" versions additionally >> take a length argument like strlcpy() itself....
2016 Jul 05
0
[PATCH v2 1/7] lib: string: add functions to case-convert strings
...ucing this code duplication. The new functions are char *strncpytoupper(char *dst, const char *src, size_t len); char *strncpytolower(char *dst, const char *src, size_t len); char *strcpytoupper(char *dst, const char *src); char *strcpytolower(char *dst, const char *src); char *strtoupper(char *s); char *strtolower(char *s); The "str[n]cpyto*" versions of the function take a destination string and a source string as arguments. The "strncpyto*" versions additionally take a length argument like strncpy() itself. Lastly, the strto* functions take a single...
2016 Jul 08
6
[PATCH v3 0/7] lib: string: add functions to case-convert strings
...d in) Consequently, I am proposing these new functions: void strlcpytoupper(char *dst, const char *src, size_t len); void strlcpytolower(char *dst, const char *src, size_t len); void strcpytoupper(char *dst, const char *src); void strcpytolower(char *dst, const char *src); void strtoupper(char *s); void strtolower(char *s); Several drivers are being modified to make use of the functions above. Another driver that also makes use of this functionality will be submitted upstream shortly, which prompted this whole exercise. The changes made here have been compile-tested, but...
2019 Sep 21
2
[PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
sscanf is sadly not safe (because it doesn't handle integer overflow correctly), and strto*l functions are a pain to use correctly. Therefore add some functions to hide the pain of parsing integers from the command line. The simpler uses of sscanf and strto*l are replaced. There are still a few where we are using advanced features of sscanf. --- docs/nbdkit-plugin.pod |...
2016 Jul 13
0
[PATCH v3 1/7] lib: string: add functions to case-convert strings
...rlcpytoupper(char *dst, const char *src, size_t len); >>>> void strlcpytolower(char *dst, const char *src, size_t len); >>>> void strcpytoupper(char *dst, const char *src); >>>> void strcpytolower(char *dst, const char *src); >>>> void strtoupper(char *s); >>>> void strtolower(char *s); >>>> >>>> The "str[l]cpyto*" versions of the function take a destination string >>>> and a source string as arguments. The "strlcpyto*" versions additionally >>>> take a...
2016 Jul 11
2
[PATCH v3 1/7] lib: string: add functions to case-convert strings
...> void strlcpytoupper(char *dst, const char *src, size_t len); >>> void strlcpytolower(char *dst, const char *src, size_t len); >>> void strcpytoupper(char *dst, const char *src); >>> void strcpytolower(char *dst, const char *src); >>> void strtoupper(char *s); >>> void strtolower(char *s); >>> >>> The "str[l]cpyto*" versions of the function take a destination string >>> and a source string as arguments. The "strlcpyto*" versions additionally >>> take a length argument lik...