diff options
| author | Jim Meyering | 2012-05-02 18:12:13 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-05-02 18:12:13 +0800 |
| commit | bf98199cf1bea244378538d60838f81cb3a34b49 (patch) | |
| tree | ee8ffe8445eb073346878b4eb2731264c97c599e /lib-src | |
| parent | cd3771a08b8a1fed5aa91eb2ac559d41801668ea (diff) | |
| download | emacs-bf98199cf1bea244378538d60838f81cb3a34b49.tar.gz emacs-bf98199cf1bea244378538d60838f81cb3a34b49.zip | |
Add NUL-termination to some uses of strncpy.
* lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
NUL-terminate the error buffer.
* src/w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372).
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 5 | ||||
| -rw-r--r-- | lib-src/pop.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index e58b291ec89..8e07193ae0c 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-05-02 Jim Meyering <meyering@redhat.com> | ||
| 2 | |||
| 3 | * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last): | ||
| 4 | NUL-terminate the error buffer (Bug#11372). | ||
| 5 | |||
| 1 | 2012-04-15 Chong Yidong <cyd@gnu.org> | 6 | 2012-04-15 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * emacsclient.c (decode_options): Move -t -n corner case handling | 8 | * emacsclient.c (decode_options): Move -t -n corner case handling |
diff --git a/lib-src/pop.c b/lib-src/pop.c index 37494d17a44..c4c7f2b4e2f 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c | |||
| @@ -346,6 +346,7 @@ pop_stat (popserver server, int *count, int *size) | |||
| 346 | if (0 == strncmp (fromserver, "-ERR", 4)) | 346 | if (0 == strncmp (fromserver, "-ERR", 4)) |
| 347 | { | 347 | { |
| 348 | strncpy (pop_error, fromserver, ERROR_MAX); | 348 | strncpy (pop_error, fromserver, ERROR_MAX); |
| 349 | pop_error[ERROR_MAX-1] = '\0'; | ||
| 349 | } | 350 | } |
| 350 | else | 351 | else |
| 351 | { | 352 | { |
| @@ -447,7 +448,10 @@ pop_list (popserver server, int message, int **IDs, int **sizes) | |||
| 447 | if (strncmp (fromserver, "+OK ", 4)) | 448 | if (strncmp (fromserver, "+OK ", 4)) |
| 448 | { | 449 | { |
| 449 | if (! strncmp (fromserver, "-ERR", 4)) | 450 | if (! strncmp (fromserver, "-ERR", 4)) |
| 450 | strncpy (pop_error, fromserver, ERROR_MAX); | 451 | { |
| 452 | strncpy (pop_error, fromserver, ERROR_MAX); | ||
| 453 | pop_error[ERROR_MAX-1] = '\0'; | ||
| 454 | } | ||
| 451 | else | 455 | else |
| 452 | { | 456 | { |
| 453 | strcpy (pop_error, | 457 | strcpy (pop_error, |
| @@ -687,6 +691,7 @@ pop_multi_first (popserver server, const char *command, char **response) | |||
| 687 | if (0 == strncmp (*response, "-ERR", 4)) | 691 | if (0 == strncmp (*response, "-ERR", 4)) |
| 688 | { | 692 | { |
| 689 | strncpy (pop_error, *response, ERROR_MAX); | 693 | strncpy (pop_error, *response, ERROR_MAX); |
| 694 | pop_error[ERROR_MAX-1] = '\0'; | ||
| 690 | return (-1); | 695 | return (-1); |
| 691 | } | 696 | } |
| 692 | else if (0 == strncmp (*response, "+OK", 3)) | 697 | else if (0 == strncmp (*response, "+OK", 3)) |
| @@ -860,6 +865,7 @@ pop_last (popserver server) | |||
| 860 | if (! strncmp (fromserver, "-ERR", 4)) | 865 | if (! strncmp (fromserver, "-ERR", 4)) |
| 861 | { | 866 | { |
| 862 | strncpy (pop_error, fromserver, ERROR_MAX); | 867 | strncpy (pop_error, fromserver, ERROR_MAX); |
| 868 | pop_error[ERROR_MAX-1] = '\0'; | ||
| 863 | return (-1); | 869 | return (-1); |
| 864 | } | 870 | } |
| 865 | else if (strncmp (fromserver, "+OK ", 4)) | 871 | else if (strncmp (fromserver, "+OK ", 4)) |