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
25ed6cc3
Commit
25ed6cc3
authored
Jun 20, 2011
by
Paul Eggert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* xfns.c: Don't assume strlen fits in int.
(xic_create_fontsetname, x_window): Use ptrdiff_t, not int.
parent
df1f27af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
src/ChangeLog
src/ChangeLog
+3
-0
src/xfns.c
src/xfns.c
+7
-6
No files found.
src/ChangeLog
View file @
25ed6cc3
2011-06-21 Paul Eggert <eggert@cs.ucla.edu>
* xfns.c: Don't assume strlen fits in int.
(xic_create_fontsetname, x_window): Use ptrdiff_t, not int.
* xdisp.c (message_log_check_duplicate): Return intmax_t,
not unsigned long, as we prefer signed integers. All callers changed.
Detect integer overflow in repeat count.
...
...
src/xfns.c
View file @
25ed6cc3
...
...
@@ -1883,7 +1883,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
/* Make a fontset name from the base font name. */
if (xic_defaut_fontset == base_fontname)
{ /* There is no base font name, use the default. */
in
t
len
=
strlen
(
base_fontname
)
+
2
;
ptrdiff_
t len = strlen (base_fontname) + 2;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
...
...
@@ -1896,7 +1896,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
- the base font where the charset spec is replaced by -*-*.
- the same but with the family also replaced with -*-*-. */
const char *p = base_fontname;
in
t
i
;
ptrdiff_
t i;
for (i = 0; *p; p++)
if (*p == '-') i++;
...
...
@@ -1904,7 +1904,8 @@ xic_create_fontsetname (const char *base_fontname, int motif)
{ /* As the font name doesn't conform to XLFD, we can't
modify it to generalize it to allcs and allfamilies.
Use the specified font plus the default. */
int
len
=
strlen
(
base_fontname
)
+
strlen
(
xic_defaut_fontset
)
+
3
;
ptrdiff_t len =
strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
...
...
@@ -1913,7 +1914,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
}
else
{
in
t
len
;
ptrdiff_
t len;
const char *p1 = NULL, *p2 = NULL, *p3 = NULL;
char *font_allcs = NULL;
char *font_allfamilies = NULL;
...
...
@@ -1940,7 +1941,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
wildcard. */
if (*p3 != '*')
{
in
t
diff
=
(
p2
-
p3
)
-
2
;
ptrdiff_
t diff = (p2 - p3) - 2;
base = alloca (strlen (base_fontname) + 1);
memcpy (base, base_fontname, p3 - base_fontname);
...
...
@@ -2434,7 +2435,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
/* Do some needed geometry management. */
{
in
t
len
;
ptrdiff_
t len;
char *tem, shell_position[32];
Arg gal[10];
int gac = 0;
...
...
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