FreeBSD Bugzilla – Attachment 268566 Details for
Bug 293485
TTY injection using TIOCSTI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Example to inject strings using TIOCSTI
inject.c (text/plain), 510 bytes, created by
Wout Decré
on 2026-03-06 08:00:02 UTC
(
hide
)
Description:
Example to inject strings using TIOCSTI
Filename:
MIME Type:
Creator:
Wout Decré
Created:
2026-03-06 08:00:02 UTC
Size:
510 bytes
patch
obsolete
>#include <sys/ioctl.h> >#include <stdio.h> >#include <string.h> > >const char NL = '\n'; > >int >main(int argc, char *argv[]) >{ > int i; > int len; > char *cmd; > > if (argc < 2) { > printf("Usage: %s <string_to_inject>\n", argv[0]); > return (1); > } > > cmd = argv[1]; > len = strlen(cmd); > > for (i = 0; i < len; i++) { > if (ioctl(0, TIOCSTI, &cmd[i]) == -1) { > perror("ioctl TIOCSTI failed"); > return (1); > } > } > > if (ioctl(0, TIOCSTI, &NL) == -1) { > perror("ioctl TIOCSTI failed"); > return (1); > } > > return (0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 293485
:
268398
| 268566