diff options
| author | Alp Aker | 2012-08-18 20:53:29 -0400 |
|---|---|---|
| committer | Alp Aker | 2012-08-18 20:53:29 -0400 |
| commit | d7191076ce331e8c78dbc93b76d0e346c268daa0 (patch) | |
| tree | 890bed4c25b26e2618c976500219f6efea05945c /src | |
| parent | e757f1c6f393cf82057dbee0a4325b07f0fd55c4 (diff) | |
| download | emacs-d7191076ce331e8c78dbc93b76d0e346c268daa0.tar.gz emacs-d7191076ce331e8c78dbc93b76d0e346c268daa0.zip | |
* nsfont.m (ns_ascii_average_width): Ensure the string
ascii_printable is initialized with a null-terminated character
array. Otherwise, it can contain undesired extra characters.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/nsfont.m | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1956d602e6a..5956eea1c51 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-08-18 Alp Aker <alp.tekin.aker@gmail.com> | ||
| 2 | |||
| 3 | * nsfont.m (ns_ascii_average_width): Ensure the string | ||
| 4 | ascii_printable is initialized with a null-terminated character | ||
| 5 | array. Otherwise, it can contain undesired extra characters. | ||
| 6 | |||
| 1 | 2012-08-18 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2012-08-18 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | port new setting code to Sun C 5.8 2005/10/13 | 9 | port new setting code to Sun C 5.8 2005/10/13 |
diff --git a/src/nsfont.m b/src/nsfont.m index 1f8d28cd238..412a6777c64 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -270,10 +270,11 @@ ns_ascii_average_width (NSFont *sfont) | |||
| 270 | 270 | ||
| 271 | if (!ascii_printable) | 271 | if (!ascii_printable) |
| 272 | { | 272 | { |
| 273 | char chars[95]; | 273 | char chars[96]; |
| 274 | int ch; | 274 | int ch; |
| 275 | for (ch = 0; ch < 95; ch++) | 275 | for (ch = 0; ch < 95; ch++) |
| 276 | chars[ch] = ' ' + ch; | 276 | chars[ch] = ' ' + ch; |
| 277 | chars[95] = '\0'; | ||
| 277 | 278 | ||
| 278 | ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; | 279 | ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; |
| 279 | } | 280 | } |