aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-10-12 23:58:12 -0700
committerPaul Eggert2011-10-12 23:58:12 -0700
commit3f4eabd19215fe1271594ac3ec81d543d2714f20 (patch)
treef80c4ffc3d0e70dc512c53784f48ab677bff9517 /src
parent682432fc544c2bb4e0531c2931d43bce085eb16a (diff)
downloademacs-3f4eabd19215fe1271594ac3ec81d543d2714f20.tar.gz
emacs-3f4eabd19215fe1271594ac3ec81d543d2714f20.zip
* editfns.c (Fuser_login_name, Fuser_full_name): Signal an error
if a uid argument is out of range, rather than relying on undefined behavior.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/editfns.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c2cf656b101..5826a4bd412 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -265,6 +265,9 @@
265 (lo_time): Use int, not EMACS_INT, when int suffices. 265 (lo_time): Use int, not EMACS_INT, when int suffices.
266 (lisp_time_argument): Check for usec out of range. 266 (lisp_time_argument): Check for usec out of range.
267 (Fencode_time): Don't assume fixnum fits in int. 267 (Fencode_time): Don't assume fixnum fits in int.
268 (Fuser_login_name, Fuser_full_name): Signal an error
269 if a uid argument is out of range, rather than relying on
270 undefined behavior.
268 * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT. 271 * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT.
269 (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT. 272 (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT.
270 (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT. 273 (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT.
diff --git a/src/editfns.c b/src/editfns.c
index ac9c20ced65..8489a47649e 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1247,7 +1247,7 @@ of the user with that uid, or nil if there is no such user. */)
1247 if (NILP (uid)) 1247 if (NILP (uid))
1248 return Vuser_login_name; 1248 return Vuser_login_name;
1249 1249
1250 id = XFLOATINT (uid); 1250 CONS_TO_INTEGER (uid, uid_t, id);
1251 BLOCK_INPUT; 1251 BLOCK_INPUT;
1252 pw = getpwuid (id); 1252 pw = getpwuid (id);
1253 UNBLOCK_INPUT; 1253 UNBLOCK_INPUT;
@@ -1306,7 +1306,8 @@ name, or nil if there is no such user. */)
1306 return Vuser_full_name; 1306 return Vuser_full_name;
1307 else if (NUMBERP (uid)) 1307 else if (NUMBERP (uid))
1308 { 1308 {
1309 uid_t u = XFLOATINT (uid); 1309 uid_t u;
1310 CONS_TO_INTEGER (uid, uid_t, u);
1310 BLOCK_INPUT; 1311 BLOCK_INPUT;
1311 pw = getpwuid (u); 1312 pw = getpwuid (u);
1312 UNBLOCK_INPUT; 1313 UNBLOCK_INPUT;