Re: [PATCH app/xinit] Buffer overflow with many arguments.
> Tobias Stöckmann hat am 19. Januar 2019 um 20:37 > geschrieben: > > > > hi, > > nice catch. > > > > instead of letting 98 magicly popup what is about > > sizeof(serverargv)/sizeof(*serverargv) ? > > Dito clientargv, > > > > re, > > wh > > There is still a pseudo-magical - 2 missing there, to keep space for the > last NULL assignment. > > But I'm fine with both. As long as 98 is the result. :) > > this is my version, like your patch but the array limit is now calculated. NTL the program needs some more. Signed-off-by: Walter Harms --- xinit.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xinit.c b/xinit.c index f826b7a..b93fe20 100644 --- a/xinit.c +++ b/xinit.c @@ -151,7 +151,6 @@ main(int argc, char *argv[]) register char **ptr; pid_t pid; int client_given = 0, server_given = 0; -int client_args_given = 0, server_args_given = 0; int start_of_client_args, start_of_server_args; struct sigaction sa, si; #ifdef __APPLE__ @@ -174,7 +173,8 @@ main(int argc, char *argv[]) } start_of_client_args = (cptr - client); while (argc && strcmp(*argv, "--")) { -client_args_given++; +if (cptr > clientargv + sizeof(clientargv)/sizeof(*clientargv)-2) + Fatalx("too many client arguments"); *cptr++ = *argv++; argc--; } @@ -202,7 +202,9 @@ main(int argc, char *argv[]) start_of_server_args = (sptr - server); while (--argc >= 0) { -server_args_given++; +if (sptr > serverargv + sizeof(serverargv) /sizeof(*serverargv)-2 ) +Fatalx("too many server arguments"); + *sptr++ = *argv++; } *sptr = NULL; -- 2.1.4 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] XF86keysym: Add XF86XK_RotationLockToggle
Hi, On 22-01-19 09:22, Walter Harms wrote: Hans de Goede hat am 21. Januar 2019 um 20:23 geschrieben: Add XF86XK_RotationLockToggle keysym, to be used as mapping for evdev's KEY_ROTATE_LOCK_TOGGLE. I've a Point of View P1006W-232 Windows tablet which actually has a rotate-lock toggle-button. The latest kernel correctly generates KEY_ROTATE_LOCK_TOGGLE events for this. So now I'm hooking up support for it through all the higher layers. Signed-off-by: Hans de Goede --- include/X11/XF86keysym.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/X11/XF86keysym.h b/include/X11/XF86keysym.h index 9ad8948..dd287e2 100644 --- a/include/X11/XF86keysym.h +++ b/include/X11/XF86keysym.h @@ -205,6 +205,8 @@ #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. theatre-mode */ +#define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock on/off */ + /* Keys for special action keys (hot keys) */ /* Virtual terminals on some operating systems */ #define XF86XK_Switch_VT_10x1008FE01 -- 2.20.1 This is ok with me but i have a general question: Is there a policy what to add ? ( i coud not find one). E.g. i have seems a keyboard with a key to change the backlight of the keyboard (do ot ask, not mine) Do we simply add everything found in the wild ? or are there limitations ? In generally yes we add anything found in the wild (and not just in specs). The limitation is applying common sense, e.g. the toggle screen rotation lock button already has an evdev button code, KEY_ROTATE_LOCK_TOGGLE and on devices with an accelerometer GNOME-shell has a toggle in its system menu (the top right menu with wifi options, etc.) to lock / unlock auto-rotating the screen. So my intention is to hook the button on the Point of View P1006W-232 Windows tablet up all the way to the gnome-shell level, so that it actually toggles that setting. IOW I would like to see adding new keysyms limited to adding keysyms which we plan to actually use. Either for a specific use-case, or as a button which will be useful as a generic(ish) button for a user to bind an action to (e.g. launch a new terminal, launch settings pane of the control panel, ...). Note this is just my 2 cents. As for your specific example, the kernel already has: #define KEY_KBDILLUMTOGGLE 228 #define KEY_KBDILLUMDOWN229 #define KEY_KBDILLUMUP 230 And xkeyboard-config/rules/inet has: key{ [ XF86KbdLightOnOff ] }; // KEY_KBDILLUMTOGGLE key{ [ XF86KbdBrightnessDown ] }; // KEY_KBDILLUMDOWN key{ [ XF86KbdBrightnessUp ] }; // KEY_KBDILLUMUP (note the X "scancodes" are eight higher then the kernel ones) And GNOME actually responds to these and does the right thing, assuming there is a *kbd_backlight interface under /sys/class/leds for it to control :) Regards, Hans ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Re: [PATCH] XF86keysym: Add XF86XK_RotationLockToggle
> Hans de Goede hat am 21. Januar 2019 um 20:23 > geschrieben: > > > Add XF86XK_RotationLockToggle keysym, to be used as mapping for evdev's > KEY_ROTATE_LOCK_TOGGLE. > > I've a Point of View P1006W-232 Windows tablet which actually has a > rotate-lock toggle-button. The latest kernel correctly generates > KEY_ROTATE_LOCK_TOGGLE events for this. So now I'm hooking up support for > it through all the higher layers. > > Signed-off-by: Hans de Goede > --- > include/X11/XF86keysym.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/X11/XF86keysym.h b/include/X11/XF86keysym.h > index 9ad8948..dd287e2 100644 > --- a/include/X11/XF86keysym.h > +++ b/include/X11/XF86keysym.h > @@ -205,6 +205,8 @@ > > #define XF86XK_AudioPreset 0x1008FFB6 /* Select equalizer preset, e.g. > theatre-mode */ > > +#define XF86XK_RotationLockToggle 0x1008FFB7 /* Toggle screen rotation lock > on/off */ > + > /* Keys for special action keys (hot keys) */ > /* Virtual terminals on some operating systems */ > #define XF86XK_Switch_VT_1 0x1008FE01 > -- > 2.20.1 > This is ok with me but i have a general question: Is there a policy what to add ? ( i coud not find one). E.g. i have seems a keyboard with a key to change the backlight of the keyboard (do ot ask, not mine) Do we simply add everything found in the wild ? or are there limitations ? re, wh > ___ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: https://lists.x.org/mailman/listinfo/xorg-devel ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel