* [Buildroot] [PATCH] package/tpm2-totp: fix error due to variable used uninitialized
@ 2019-05-26 23:24 unixmania at gmail.com
2019-05-27 8:54 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: unixmania at gmail.com @ 2019-05-26 23:24 UTC (permalink / raw)
To: buildroot
From: Carlos Santos <unixmania@gmail.com>
Some inline declarations of strtok_r (specifically in Sourcery CodeBench
Lite 2016.11-19) contain code where an '__s' local variable can be used
uninitialized.
When GCC expands that declaration in tpm2-totp, __s becomes an alias to
a variable which fact is not initialized, but this is not relevant since
the execution path leading to the uninitialized use is never followed.
Anyway, apply a patch already submitted upstream to fix the compilation
error.
Upstream bug report:
https://github.com/tpm2-software/tpm2-totp/issues/32
Fixes:
http://autobuild.buildroot.net/results/5693a35e4d6bc76a1f46fe0e217abc49f7188aad/
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
...ion-failure-due-to-variable-may-be-u.patch | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 package/tpm2-totp/0002-src-fix-compilation-failure-due-to-variable-may-be-u.patch
diff --git a/package/tpm2-totp/0002-src-fix-compilation-failure-due-to-variable-may-be-u.patch b/package/tpm2-totp/0002-src-fix-compilation-failure-due-to-variable-may-be-u.patch
new file mode 100644
index 0000000000..a650ab49f4
--- /dev/null
+++ b/package/tpm2-totp/0002-src-fix-compilation-failure-due-to-variable-may-be-u.patch
@@ -0,0 +1,42 @@
+From 194f41635367452a7a3c9a75ebbada531bf4c58d Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 26 May 2019 13:39:44 -0300
+Subject: [PATCH] src: fix compilation failure due to "variable may be used
+ uninitialized"
+
+Some inline declarations of strtok_r (specifically in Sourcery CodeBench
+Lite 2016.11-19) contain code where an '__s' local variable can be used
+uninitialized.
+
+When GCC expands that declaration in 'parse_pcrs', __s becomes an alias
+to the local variable 'saveptr', which in fact is not initialized, but
+this is not relevant, since the 'str' argument is knowingly not NULL
+when passed to strtok_r because it comes from 'optarg' in parse_opts.
+
+Anyway, initialize saveptr to NULL to prevent the compilation error.
+
+Fixes:
+ http://autobuild.buildroot.net/results/5693a35e4d6bc76a1f46fe0e217abc49f7188aad/
+
+Change-Id: I03ad3731774c56744f18154ec161c92ba002903d
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ src/tpm2-totp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tpm2-totp.c b/src/tpm2-totp.c
+index 3f60b4a..f28a4d6 100644
+--- a/src/tpm2-totp.c
++++ b/src/tpm2-totp.c
+@@ -93,7 +93,7 @@ int
+ parse_pcrs(char *str, int *pcrs)
+ {
+ char *token;
+- char *saveptr;
++ char *saveptr = NULL;
+ char *endptr;
+ long pcr;
+
+--
+2.20.1
+
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH] package/tpm2-totp: fix error due to variable used uninitialized
2019-05-26 23:24 [Buildroot] [PATCH] package/tpm2-totp: fix error due to variable used uninitialized unixmania at gmail.com
@ 2019-05-27 8:54 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2019-05-27 8:54 UTC (permalink / raw)
To: buildroot
>>>>> "unixmania" == unixmania <unixmania@gmail.com> writes:
> From: Carlos Santos <unixmania@gmail.com>
> Some inline declarations of strtok_r (specifically in Sourcery CodeBench
> Lite 2016.11-19) contain code where an '__s' local variable can be used
> uninitialized.
> When GCC expands that declaration in tpm2-totp, __s becomes an alias to
> a variable which fact is not initialized, but this is not relevant since
> the execution path leading to the uninitialized use is never followed.
> Anyway, apply a patch already submitted upstream to fix the compilation
> error.
> Upstream bug report:
> https://github.com/tpm2-software/tpm2-totp/issues/32
> Fixes:
> http://autobuild.buildroot.net/results/5693a35e4d6bc76a1f46fe0e217abc49f7188aad/
> Signed-off-by: Carlos Santos <unixmania@gmail.com>
Great, I also just started looking at the issue - Committed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-27 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-26 23:24 [Buildroot] [PATCH] package/tpm2-totp: fix error due to variable used uninitialized unixmania at gmail.com
2019-05-27 8:54 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.