summaryrefslogtreecommitdiff
path: root/lisp/ls-lisp.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-01-19 00:50:53 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2014-01-19 00:50:53 -0800
commitd70efef4a8e5c12db9fe3c305aa9590a91be8467 (patch)
treea1fc8f230c757b69fe96f8b1973cf4da7ea0376d /lisp/ls-lisp.el
parent9a685cf6bdb1636008acaf84ec8c1b3d3e21f419 (diff)
downloademacs-d70efef4a8e5c12db9fe3c305aa9590a91be8467.tar.gz
emacs-d70efef4a8e5c12db9fe3c305aa9590a91be8467.tar.bz2
emacs-d70efef4a8e5c12db9fe3c305aa9590a91be8467.zip
update-game-score fixes for -m and integer overflow
* update-game-score.c: Include inttypes.h, stdbool.h. (min): New macro, if not already defined. (MAX_SCORES, main): Limit the maximum number of scores only from limits imposed by the underyling platform, instead of the arbitrary value 200. (struct score_entry, main, read_score, write_score): Scores are now intmax_t, not long. (get_user_id): Reject user names containing spaces or newlines, as they would mess up the score file. Allow uids that don't fit in 'long'. Increase the size of the buffer, to avoid overrun in weird cases. (get_prefix, main): Use bool for boolean. (main): Rewrite expr to avoid possibility of signed integer overflow. Don't allow newlines in data, as this would mess up the score file. Check for memory allocation failure when adding the new score, or when unlockint the file. Implement -m. (read_score): Check for integer overflow when reading a score. (read_score) [!HAVE_GETDELIM]: Check for integer overflow when data gets very long. Check only for space to delimit names, since that's what's done in the HAVE_GETDELIM case. (read_scores): New parameter ALLOC. Change counts to ptrdiff_t. All uses changed. Use push_score to add individual scores; that's simpler than repeating its contents. (score_compare_reverse): Simplify. (push_score): New parameter SIZE. Change counts to ptrdiff_t. All uses changed. Check for integer overflow of size calculation. (sort_scores, write_scores): Change counts to ptrdiff_t. (unlock_file): Preserve errno on success, so that storage exhaustion is diagnosed correctly. Fixes: debbugs:16428
Diffstat (limited to 'lisp/ls-lisp.el')
0 files changed, 0 insertions, 0 deletions