mirror of OpenBSD xenocara tree github.com/openbsd/xenocara
openbsd
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update xmodpap to version 1.0.11

matthieu d1460721 1d3ce466

+207 -57
+99 -4
app/xmodmap/ChangeLog
··· 1 + commit 5579ae02a6b44f3072955f3e2f3249d2bd1201e4 2 + Author: Alan Coopersmith <alan.coopersmith@oracle.com> 3 + Date: Sun Jul 10 15:49:43 2022 -0700 4 + 5 + xmodmap 1.0.11 6 + 7 + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 8 + 9 + commit 34df50af33d38621ce5d5a5510c7a4e70e1c17c1 10 + Author: Alan Coopersmith <alan.coopersmith@oracle.com> 11 + Date: Sun Apr 17 10:34:10 2022 -0700 12 + 13 + PrintModifierMapping: stop leaking the map returned by XGetKeyboardMapping 14 + 15 + Resolves issue reported by Oracle Parfait static analyzer: 16 + 17 + Error: Memory leak 18 + Memory leak [memory-leak] (CWE 401): 19 + Memory leak of pointer pointer allocated with XGetKeyboardMapping(...) 20 + at line 251 of app/xmodmap/exec.c in function 'PrintModifierMapping'. 21 + pointer allocated at line 222 with XGetKeyboardMapping(...) 22 + 23 + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 24 + 25 + commit 10eecbe868b5c898ea9cd05d014fbf13c29c3a26 26 + Author: Alan Coopersmith <alan.coopersmith@oracle.com> 27 + Date: Sun Apr 17 10:19:58 2022 -0700 28 + 29 + handle.c: avoid leaks when realloc() fails 30 + 31 + Resolves issues reported by Oracle Parfait static analyzer: 32 + 33 + Error: Memory leak 34 + Memory leak [memory-leak] (CWE 401): 35 + Memory leak of pointer kclist allocated with malloc((n * 1)) 36 + at line 698 of app/xmodmap/handle.c in function 'do_remove'. 37 + kclist allocated at line 662 with malloc((n * 1)) 38 + kclist leaks when num_kcs != 0 at line 676 39 + and (j + 1) >= num_kcs at line 687 40 + and (nc + num_kcs) > tot at line 691 41 + and (num_kcs - 1) < 0 at line 701. 42 + Memory leak [memory-leak] (CWE 401): 43 + Memory leak of pointer kclist allocated with malloc((n * 1)) 44 + at line 711 of app/xmodmap/handle.c in function 'do_remove'. 45 + kclist allocated at line 662 with malloc((n * 1)) 46 + kclist leaks when (i + 1) >= n at line 672. 47 + Error: Memory leak 48 + Memory leak [memory-leak] (CWE 401): 49 + Memory leak of pointer kclist allocated with realloc(kclist, (tot * 1)) 50 + at line 711 of app/xmodmap/handle.c in function 'do_remove'. 51 + kclist allocated at line 693 with realloc(kclist, (tot * 1)) 52 + kclist leaks when (num_kcs - 1) < 0 at line 701 53 + and (i + 1) >= n at line 672. 54 + 55 + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 56 + 57 + commit d14cb47d9e9a10d04b1a7de9d2799fef9b0436e0 58 + Author: Alan Coopersmith <alan.coopersmith@oracle.com> 59 + Date: Tue Dec 7 12:36:29 2021 -0800 60 + 61 + Build xz tarballs instead of bzip2 62 + 63 + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 64 + 65 + commit 90e2004549d79093ef7e1c17f99e64331c3e6661 66 + Author: Alan Coopersmith <alan.coopersmith@oracle.com> 67 + Date: Tue Dec 7 12:36:27 2021 -0800 68 + 69 + gitlab CI: add a basic build test 70 + 71 + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 72 + 73 + commit fa9c38e6e7f1caa12d38f35c5633735bcaef3ba1 74 + Author: Karl Fogel <kfogel@red-bean.com> 75 + Date: Sat Mar 16 21:29:04 2019 -0500 76 + 77 + Fix warning about number of mouse buttons 78 + 79 + Change a warning to distinguish between too few buttons and too many. 80 + 81 + Before this change: 82 + 83 + $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" 84 + Warning: Only changing the first 15 of 10 buttons. 85 + $ 86 + 87 + After this change: 88 + 89 + $ xmodmap -e "pointer = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" 90 + Warning: Not changing 5 extra buttons beyond 10. 91 + $ 92 + 93 + Fixes: https://gitlab.freedesktop.org/xorg/app/xmodmap/issues/2 94 + Signed-off-by: Karl Fogel <kfogel@red-bean.com> 95 + 1 96 commit c5a5fb06fd25c044f343f4571c645fd6c954d038 2 97 Author: Alan Coopersmith <alan.coopersmith@oracle.com> 3 98 Date: Tue Feb 19 15:33:29 2019 -0800 ··· 193 288 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> 194 289 195 290 commit bf4620e2d78d2a4766948f136f2372a596ac275d 196 - Author: Stéphane Aulery <lkppo@free.fr> 291 + Author: Stéphane Aulery <lkppo@free.fr> 197 292 Date: Sun Jun 30 01:50:58 2013 +0200 198 293 199 294 error in manpage example about swapping Control_L/Caps_Lock keys ··· 762 857 Use sed to fill in variables in man page 763 858 764 859 commit c4483b314106bcd2bb13e49650cfd279f74da73e 765 - Author: Kristian Høgsberg <krh@redhat.com> 860 + Author: Kristian Høgsberg <krh@redhat.com> 766 861 Date: Wed Sep 28 19:28:15 2005 +0000 767 862 768 863 Copy bits from COPYING here. ··· 790 885 Add build system for xmodmap Add xmodmap to build script 791 886 792 887 commit 9145de293109ba96fc8b97ac59c16c51b992f416 793 - Author: Kristian Høgsberg <krh@redhat.com> 888 + Author: Kristian Høgsberg <krh@redhat.com> 794 889 Date: Thu Nov 11 15:37:01 2004 +0000 795 890 796 891 Fix #1818 ··· 814 909 4637857 - fix by Sam Lau) 815 910 816 911 commit ce64b2b312a73b9a4f266da8810ab552af4fbb1e 817 - Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> 912 + Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> 818 913 Date: Fri Oct 15 00:44:08 2004 +0000 819 914 820 915 Thu Oct 14 20:43:03 2004 Søren Sandmann <sandmann@redhat.com>
+4 -3
app/xmodmap/Makefile.in
··· 180 180 dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ 181 181 done; \ 182 182 reldir="$$dir2" 183 - DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 183 + DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz 184 184 GZIP_ENV = --best 185 - DIST_TARGETS = dist-bzip2 dist-gzip 185 + DIST_TARGETS = dist-xz dist-gzip 186 186 distuninstallcheck_listfiles = find . -type f -print 187 187 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ 188 188 | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' ··· 302 302 prefix = @prefix@ 303 303 program_transform_name = @program_transform_name@ 304 304 psdir = @psdir@ 305 + runstatedir = @runstatedir@ 305 306 sbindir = @sbindir@ 306 307 sharedstatedir = @sharedstatedir@ 307 308 srcdir = @srcdir@ ··· 659 660 dist-gzip: distdir 660 661 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 661 662 $(am__post_remove_distdir) 663 + 662 664 dist-bzip2: distdir 663 665 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 664 666 $(am__post_remove_distdir) ··· 666 668 dist-lzip: distdir 667 669 tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz 668 670 $(am__post_remove_distdir) 669 - 670 671 dist-xz: distdir 671 672 tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz 672 673 $(am__post_remove_distdir)
+8 -8
app/xmodmap/aclocal.m4
··· 19 19 If you have problems, you may need to regenerate the build system entirely. 20 20 To do so, use the procedure documented by the package, typically 'autoreconf'.])]) 21 21 22 - dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 23 - dnl serial 11 (pkg-config-0.29.1) 24 - dnl 22 + # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 23 + # serial 12 (pkg-config-0.29.2) 24 + 25 25 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 26 26 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> 27 27 dnl ··· 62 62 dnl See the "Since" comment for each macro you use to see what version 63 63 dnl of the macros you require. 64 64 m4_defun([PKG_PREREQ], 65 - [m4_define([PKG_MACROS_VERSION], [0.29.1]) 65 + [m4_define([PKG_MACROS_VERSION], [0.29.2]) 66 66 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, 67 67 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) 68 68 ])dnl PKG_PREREQ ··· 163 163 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl 164 164 165 165 pkg_failed=no 166 - AC_MSG_CHECKING([for $1]) 166 + AC_MSG_CHECKING([for $2]) 167 167 168 168 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) 169 169 _PKG_CONFIG([$1][_LIBS], [libs], [$2]) ··· 173 173 See the pkg-config man page for more details.]) 174 174 175 175 if test $pkg_failed = yes; then 176 - AC_MSG_RESULT([no]) 176 + AC_MSG_RESULT([no]) 177 177 _PKG_SHORT_ERRORS_SUPPORTED 178 178 if test $_pkg_short_errors_supported = yes; then 179 179 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` 180 - else 180 + else 181 181 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` 182 182 fi 183 183 # Put the nasty error message in config.log where it belongs ··· 194 194 _PKG_TEXT])[]dnl 195 195 ]) 196 196 elif test $pkg_failed = untried; then 197 - AC_MSG_RESULT([no]) 197 + AC_MSG_RESULT([no]) 198 198 m4_default([$4], [AC_MSG_FAILURE( 199 199 [The pkg-config script could not be found or is too old. Make sure it 200 200 is in your PATH or set the PKG_CONFIG environment variable to the full
+9 -8
app/xmodmap/compile
··· 1 1 #! /bin/sh 2 2 # Wrapper for compilers which do not understand '-c -o'. 3 3 4 - scriptversion=2012-10-14.11; # UTC 4 + scriptversion=2018-03-07.03; # UTC 5 5 6 - # Copyright (C) 1999-2014 Free Software Foundation, Inc. 6 + # Copyright (C) 1999-2021 Free Software Foundation, Inc. 7 7 # Written by Tom Tromey <tromey@cygnus.com>. 8 8 # 9 9 # This program is free software; you can redistribute it and/or modify ··· 17 17 # GNU General Public License for more details. 18 18 # 19 19 # You should have received a copy of the GNU General Public License 20 - # along with this program. If not, see <http://www.gnu.org/licenses/>. 20 + # along with this program. If not, see <https://www.gnu.org/licenses/>. 21 21 22 22 # As a special exception to the GNU General Public License, if you 23 23 # distribute this file as part of a program that contains a ··· 53 53 MINGW*) 54 54 file_conv=mingw 55 55 ;; 56 - CYGWIN*) 56 + CYGWIN* | MSYS*) 57 57 file_conv=cygwin 58 58 ;; 59 59 *) ··· 67 67 mingw/*) 68 68 file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` 69 69 ;; 70 - cygwin/*) 70 + cygwin/* | msys/*) 71 71 file=`cygpath -m "$file" || echo "$file"` 72 72 ;; 73 73 wine/*) ··· 255 255 echo "compile $scriptversion" 256 256 exit $? 257 257 ;; 258 - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) 258 + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ 259 + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) 259 260 func_cl_wrapper "$@" # Doesn't return... 260 261 ;; 261 262 esac ··· 339 340 # Local Variables: 340 341 # mode: shell-script 341 342 # sh-indentation: 2 342 - # eval: (add-hook 'write-file-hooks 'time-stamp) 343 + # eval: (add-hook 'before-save-hook 'time-stamp) 343 344 # time-stamp-start: "scriptversion=" 344 345 # time-stamp-format: "%:y-%02m-%02d.%02H" 345 - # time-stamp-time-zone: "UTC" 346 + # time-stamp-time-zone: "UTC0" 346 347 # time-stamp-end: "; # UTC" 347 348 # End:
+27 -15
app/xmodmap/configure
··· 1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 - # Generated by GNU Autoconf 2.69 for xmodmap 1.0.10. 3 + # Generated by GNU Autoconf 2.69 for xmodmap 1.0.11. 4 4 # 5 5 # Report bugs to <https://gitlab.freedesktop.org/xorg/app/xmodmap/issues>. 6 6 # ··· 581 581 # Identity of this package. 582 582 PACKAGE_NAME='xmodmap' 583 583 PACKAGE_TARNAME='xmodmap' 584 - PACKAGE_VERSION='1.0.10' 585 - PACKAGE_STRING='xmodmap 1.0.10' 584 + PACKAGE_VERSION='1.0.11' 585 + PACKAGE_STRING='xmodmap 1.0.11' 586 586 PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xmodmap/issues' 587 587 PACKAGE_URL='' 588 588 ··· 733 733 docdir 734 734 oldincludedir 735 735 includedir 736 + runstatedir 736 737 localstatedir 737 738 sharedstatedir 738 739 sysconfdir ··· 816 817 sysconfdir='${prefix}/etc' 817 818 sharedstatedir='${prefix}/com' 818 819 localstatedir='${prefix}/var' 820 + runstatedir='${localstatedir}/run' 819 821 includedir='${prefix}/include' 820 822 oldincludedir='/usr/include' 821 823 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' ··· 1068 1070 | -silent | --silent | --silen | --sile | --sil) 1069 1071 silent=yes ;; 1070 1072 1073 + -runstatedir | --runstatedir | --runstatedi | --runstated \ 1074 + | --runstate | --runstat | --runsta | --runst | --runs \ 1075 + | --run | --ru | --r) 1076 + ac_prev=runstatedir ;; 1077 + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 1078 + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 1079 + | --run=* | --ru=* | --r=*) 1080 + runstatedir=$ac_optarg ;; 1081 + 1071 1082 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 1072 1083 ac_prev=sbindir ;; 1073 1084 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ ··· 1205 1216 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ 1206 1217 datadir sysconfdir sharedstatedir localstatedir includedir \ 1207 1218 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 1208 - libdir localedir mandir 1219 + libdir localedir mandir runstatedir 1209 1220 do 1210 1221 eval ac_val=\$$ac_var 1211 1222 # Remove trailing slashes. ··· 1318 1329 # Omit some internal or obsolete options to make the list less imposing. 1319 1330 # This message is too long to be a string in the A/UX 3.1 sh. 1320 1331 cat <<_ACEOF 1321 - \`configure' configures xmodmap 1.0.10 to adapt to many kinds of systems. 1332 + \`configure' configures xmodmap 1.0.11 to adapt to many kinds of systems. 1322 1333 1323 1334 Usage: $0 [OPTION]... [VAR=VALUE]... 1324 1335 ··· 1358 1369 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 1359 1370 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 1360 1371 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 1372 + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] 1361 1373 --libdir=DIR object code libraries [EPREFIX/lib] 1362 1374 --includedir=DIR C header files [PREFIX/include] 1363 1375 --oldincludedir=DIR C header files for non-gcc [/usr/include] ··· 1388 1400 1389 1401 if test -n "$ac_init_help"; then 1390 1402 case $ac_init_help in 1391 - short | recursive ) echo "Configuration of xmodmap 1.0.10:";; 1403 + short | recursive ) echo "Configuration of xmodmap 1.0.11:";; 1392 1404 esac 1393 1405 cat <<\_ACEOF 1394 1406 ··· 1505 1517 test -n "$ac_init_help" && exit $ac_status 1506 1518 if $ac_init_version; then 1507 1519 cat <<\_ACEOF 1508 - xmodmap configure 1.0.10 1520 + xmodmap configure 1.0.11 1509 1521 generated by GNU Autoconf 2.69 1510 1522 1511 1523 Copyright (C) 2012 Free Software Foundation, Inc. ··· 1920 1932 This file contains any messages produced by compilers while 1921 1933 running configure, to aid debugging if configure makes a mistake. 1922 1934 1923 - It was created by xmodmap $as_me 1.0.10, which was 1935 + It was created by xmodmap $as_me 1.0.11, which was 1924 1936 generated by GNU Autoconf 2.69. Invocation command line was 1925 1937 1926 1938 $ $0 $@ ··· 4061 4073 4062 4074 # Define the identity of the package. 4063 4075 PACKAGE='xmodmap' 4064 - VERSION='1.0.10' 4076 + VERSION='1.0.11' 4065 4077 4066 4078 4067 4079 cat >>confdefs.h <<_ACEOF ··· 10649 10661 # Checks for pkg-config packages 10650 10662 10651 10663 pkg_failed=no 10652 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMODMAP" >&5 10653 - $as_echo_n "checking for XMODMAP... " >&6; } 10664 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for x11 xproto >= 7.0.25" >&5 10665 + $as_echo_n "checking for x11 xproto >= 7.0.25... " >&6; } 10654 10666 10655 10667 if test -n "$XMODMAP_CFLAGS"; then 10656 10668 pkg_cv_XMODMAP_CFLAGS="$XMODMAP_CFLAGS" ··· 10690 10702 10691 10703 10692 10704 if test $pkg_failed = yes; then 10693 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10705 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10694 10706 $as_echo "no" >&6; } 10695 10707 10696 10708 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ··· 10717 10729 and XMODMAP_LIBS to avoid the need to call pkg-config. 10718 10730 See the pkg-config man page for more details." "$LINENO" 5 10719 10731 elif test $pkg_failed = untried; then 10720 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10732 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 10721 10733 $as_echo "no" >&6; } 10722 10734 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 10723 10735 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ··· 11381 11393 # report actual input values of CONFIG_FILES etc. instead of their 11382 11394 # values after options handling. 11383 11395 ac_log=" 11384 - This file was extended by xmodmap $as_me 1.0.10, which was 11396 + This file was extended by xmodmap $as_me 1.0.11, which was 11385 11397 generated by GNU Autoconf 2.69. Invocation command line was 11386 11398 11387 11399 CONFIG_FILES = $CONFIG_FILES ··· 11447 11459 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 11448 11460 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" 11449 11461 ac_cs_version="\\ 11450 - xmodmap config.status 1.0.10 11462 + xmodmap config.status 1.0.11 11451 11463 configured by $0, generated by GNU Autoconf 2.69, 11452 11464 with options \\"\$ac_cs_config\\" 11453 11465
+2 -2
app/xmodmap/configure.ac
··· 24 24 # Initialize Autoconf 25 25 AC_PREREQ([2.60]) 26 26 AC_INIT([xmodmap], 27 - [1.0.10], 27 + [1.0.11], 28 28 [https://gitlab.freedesktop.org/xorg/app/xmodmap/issues], 29 29 [xmodmap]) 30 30 AC_CONFIG_SRCDIR([Makefile.am]) ··· 33 33 AC_USE_SYSTEM_EXTENSIONS 34 34 35 35 # Initialize Automake 36 - AM_INIT_AUTOMAKE([foreign dist-bzip2]) 36 + AM_INIT_AUTOMAKE([foreign dist-xz]) 37 37 38 38 # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS 39 39 m4_ifndef([XORG_MACROS_VERSION],
+17 -10
app/xmodmap/exec.c
··· 208 208 return (0); 209 209 } 210 210 211 + static int 212 + GetKeysymsPerKeycode(void) 213 + { 214 + int min_keycode, max_keycode, keysyms_per_keycode = 0; 215 + KeySym *m; 216 + 217 + XDisplayKeycodes(dpy, &min_keycode, &max_keycode); 218 + m = XGetKeyboardMapping(dpy, min_keycode, (max_keycode - min_keycode + 1), 219 + &keysyms_per_keycode); 220 + XFree(m); 221 + return keysyms_per_keycode; 222 + } 211 223 212 224 /* 213 225 * print the contents of the map ··· 215 227 void 216 228 PrintModifierMapping(XModifierKeymap *map, FILE *fp) 217 229 { 218 - int i, k = 0; 219 - int min_keycode, max_keycode, keysyms_per_keycode = 0; 220 - 221 - XDisplayKeycodes (dpy, &min_keycode, &max_keycode); 222 - XGetKeyboardMapping (dpy, min_keycode, (max_keycode - min_keycode + 1), 223 - &keysyms_per_keycode); 230 + int k = 0; 231 + int keysyms_per_keycode = GetKeysymsPerKeycode(); 224 232 225 233 fprintf (fp, 226 234 "%s: up to %d keys per modifier, (keycodes in parentheses):\n\n", 227 235 ProgramName, map->max_keypermod); 228 - for (i = 0; i < 8; i++) { 229 - int j; 230 - 236 + for (int i = 0; i < 8; i++) { 231 237 fprintf(fp, "%-10s", modifier_table[i].name); 232 - for (j = 0; j < map->max_keypermod; j++) { 238 + 239 + for (int j = 0; j < map->max_keypermod; j++) { 233 240 if (map->modifiermap[k]) { 234 241 KeySym ks; 235 242 int index = 0;
+40 -7
app/xmodmap/handle.c
··· 37 37 #include "xmodmap.h" 38 38 #include "wq.h" 39 39 #include <stdlib.h> 40 + #include <stdint.h> 40 41 41 42 #ifdef HAVE_STRNCASECMP 42 43 #include <strings.h> ··· 59 60 * common utility routines 60 61 */ 61 62 63 + /* 64 + * This is a combination of reallocf() and reallocarray(). 65 + * If the realloc fails, it frees the old pointer so it doesn't leak. 66 + */ 67 + static void * 68 + reallocfarray(void *old, size_t num, size_t size) 69 + { 70 + static void *new; 71 + 72 + if (size > 0 && num > (SIZE_MAX / size)) /* overflow would happen */ 73 + new = NULL; 74 + else 75 + new = realloc(old, num * size); 76 + 77 + if (new == NULL) 78 + free(old); 79 + 80 + return new; 81 + } 82 + 62 83 static KeyCode * 63 84 KeysymToKeycodes(Display *dpy, KeySym keysym, int *pnum_kcs) 64 85 { ··· 72 93 if (!kcs) 73 94 kcs = malloc(sizeof(KeyCode)); 74 95 else 75 - kcs = realloc(kcs, sizeof(KeyCode) * (*pnum_kcs + 1)); 96 + kcs = reallocfarray(kcs, (*pnum_kcs + 1), sizeof(KeyCode)); 97 + if (!kcs) { 98 + fprintf(stderr, "attempt to allocate %ld byte keycode set", 99 + (long) ((*pnum_kcs + 1) * sizeof (KeyCode))); 100 + return NULL; 101 + } 76 102 kcs[*pnum_kcs] = i; 77 103 *pnum_kcs += 1; 78 104 break; ··· 690 716 } 691 717 if (nc + num_kcs > tot) { 692 718 tot = nc + num_kcs; 693 - kclist = realloc(kclist, tot * sizeof(KeyCode)); 719 + kclist = reallocfarray(kclist, tot, sizeof(KeyCode)); 694 720 if (!kclist) { 695 721 badmsg ("attempt to allocate %ld byte keycode list", 696 722 (long) (tot * sizeof (KeyCode))); ··· 708 734 if (!uop) { 709 735 badmsg ("attempt to allocate %ld byte removemodifier opcode", 710 736 (long) sizeof (struct op_removemodifier)); 737 + free(kclist); 711 738 return; 712 739 } 713 740 oprm = &uop->removemodifier; ··· 889 916 } 890 917 891 918 if (i > 0 && i != nbuttons) { 892 - fprintf (stderr, "Warning: Only changing the first %d of %d buttons.\n", 893 - i, nbuttons); 919 + if (i < nbuttons) { 920 + fprintf (stderr, 921 + "Warning: Only changing the first %d of %d buttons.\n", 922 + i, nbuttons); 923 + } 924 + else { /* i > nbuttons */ 925 + fprintf (stderr, 926 + "Warning: Not changing %d extra buttons beyond %d.\n", 927 + i - nbuttons, nbuttons); 928 + } 894 929 i = nbuttons; 895 930 } 896 931 ··· 974 1009 975 1010 /* grow the list bigger if necessary */ 976 1011 if (havesofar >= maxcanhave) { 977 - KeySym *origkeysymlist = keysymlist; 978 1012 maxcanhave *= 2; 979 - keysymlist = realloc (keysymlist, maxcanhave * sizeof (KeySym)); 1013 + keysymlist = reallocfarray(keysymlist, maxcanhave, sizeof(KeySym)); 980 1014 if (!keysymlist) { 981 1015 badmsg ("attempt to grow keysym list to %ld bytes", 982 1016 (long) (maxcanhave * sizeof (KeySym))); 983 - free(origkeysymlist); 984 1017 return (-1); 985 1018 } 986 1019 }
+1
app/xmodmap/man/Makefile.in
··· 247 247 prefix = @prefix@ 248 248 program_transform_name = @program_transform_name@ 249 249 psdir = @psdir@ 250 + runstatedir = @runstatedir@ 250 251 sbindir = @sbindir@ 251 252 sharedstatedir = @sharedstatedir@ 252 253 srcdir = @srcdir@