-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sscanf type mismatch #679
Comments
stefanberger
added a commit
that referenced
this issue
Mar 26, 2022
The port being parsed must be given as unsigned int so that the comparison of *tcp_port >= 65536 also captures negative numbers passed via the command line. Previously one could pass -1 and swtpm_ioctl would try to connect to port 65535. Resolves: #679 Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
Passing --tcp :-1 would try to connect to port 65535, which was a bug. |
stefanberger
added a commit
that referenced
this issue
Mar 26, 2022
…bers The port being parsed must be given as unsigned int so that the comparison of *tcp_port >= 65536 also captures negative numbers passed via the command line. Previously one could pass -1 and swtpm_ioctl would try to connect to port 65535. Resolves: #679 Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
|
Thanks for reporting this bug. |
stefanberger
added a commit
that referenced
this issue
Mar 28, 2022
…mbers The port being parsed must be given as unsigned int so that the comparison of *tcp_port >= 65536 also filters out negative numbers passed via the command line. Previously one could pass -1 and swtpm_ioctl would try to connect to port 65535. Resolves: #679 Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
swtpm/src/swtpm_ioctl/tpm_ioctl.c
Line 820 in 2579038
Hello,
parse_tcp_optarg()takes anint *tcp_portparameter, and passes this tosscanf():My copy of
sscanf(3)includes:and
fscanf(3posix)includes:What happens if someone enters a number in the three billion range? Will it become vastly negative and easily pass the
if (*tcp_port >= 65536)condition?Does it matter?
Thanks
The text was updated successfully, but these errors were encountered: