Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f76dee0c
Commit
f76dee0c
authored
Apr 28, 2011
by
Paul Eggert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
parent
fdc5744d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
src/ChangeLog
src/ChangeLog
+4
-0
src/doprnt.c
src/doprnt.c
+6
-2
No files found.
src/ChangeLog
View file @
f76dee0c
2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
* doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
2011-04-28 Juanma Barranquero <lekktu@gmail.com>
* w32.c (init_environment): Warn about defaulting HOME to C:\.
...
...
src/doprnt.c
View file @
f76dee0c
...
...
@@ -198,8 +198,12 @@ doprnt (char *buffer, register size_t bufsize, const char *format,
while
(
fmt
<
format_end
&&
'0'
<=
fmt
[
1
]
&&
fmt
[
1
]
<=
'9'
)
{
if
(
n
>=
SIZE_MAX
/
10
||
n
*
10
>
SIZE_MAX
-
(
fmt
[
1
]
-
'0'
))
/* Avoid int overflow, because many sprintfs seriously
mess up with widths or precisions greater than
INT_MAX. Avoid size_t overflow, since our counters
use size_t. This test is slightly conservative, for
speed and simplicity. */
if
(
n
>=
min
(
INT_MAX
,
SIZE_MAX
)
/
10
)
error
(
"Format width or precision too large"
);
n
=
n
*
10
+
fmt
[
1
]
-
'0'
;
*
string
++
=
*++
fmt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment