handshake: don't print NULL pmksa pointer
PATCH 1/1 handshake: don't print NULL pmksa pointer
This is undefined behavior so if no pmksa is found don't print.
--- src/handshake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/handshake.c +2 -2
@@ -1272,11 +1272,11 @@ void handshake_state_cache_pmksa(struct handshake_state *s) {struct pmksa *pmksa =handshake_state_steal_pmksa (s); -l_debug ("%p" , pmksa); -if (!pmksa)return ; +l_debug ("%p" , pmksa); +if (L_WARN_ON (pmksa_cache_put (pmksa) <0 ))l_free (pmksa); }
Signature · 1 line
2.34.1
Hi James,
Quoted 10 lines · James Prestwood
This is undefined behavior so if no pmksa is found don't print.
--- src/handshake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)src/handshake.c +0
-0
src/handshake.c void handshake_state_cache_pmksa(struct handshake_state *s) · line 1276
Quoted 5 lines
src/handshake.c +0
-2@@ -1272,11 +1272,11 @@ void handshake_state_cache_pmksa(struct handshake_state *s) {struct pmksa *pmksa =handshake_state_steal_pmksa (s); -l_debug ("%p" , pmksa); -
Why is this behavior undefined? Would it not just print 0x0000...?
src/handshake.c void handshake_state_cache_pmksa(struct handshake_state *s) · line 1282
Quoted 8 lines
src/handshake.c +2
-0if (!pmksa)return ; +l_debug ("%p" , pmksa); +if (L_WARN_ON (pmksa_cache_put (pmksa) <0 ))l_free (pmksa); }
Regards,
-Denis
Hi Denis,
Quoted 8 lines · Denis Kenzior
Hi James,
Quoted 5 lines · James Prestwood
This is undefined behavior so if no pmksa is found don't print.
---
src/handshake.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines
src/handshake.c void handshake_state_cache_pmksa(struct · line 1276
Quoted 10 lines
src/handshake.c +0
-1@@ -1272,11 +1272,11 @@ void handshake_state_cache_pmksa(struct handshake_state *s) { struct pmksa *pmksa = handshake_state_steal_pmksa(s); - l_debug("%p", pmksa); -Why is this behavior undefined? Would it not just print
0x0000...?
I had a brain fart, I was thinking for some reason it was using %s not %p. So yes, this is a valid input to the %p formatter.
I can alter the commit description, but I do think it still makes sense to move the print, or at least modify it to make it clear no PMKSA was cached, rather than just printing "nul" or "nil" or "0x0000".
Quoted 11 lines
src/handshake.c void handshake_state_cache_pmksa(struct handshake_state *s) · line 1282
Quoted 8 lines
src/handshake.c +1
-0if (!pmksa) return; + l_debug("%p", pmksa); + if (L_WARN_ON(pmksa_cache_put(pmksa) < 0)) l_free(pmksa); }Regards,
-Denis
Hi James,
Quoted 6 lines
Quoted 2 lines
Why is this behavior undefined? Would it not just print
0x0000...?I had a brain fart, I was thinking for some reason it was using %s not %p. So yes, this is a valid input to the %p formatter.
I can alter the commit description, but I do think it still makes sense to move the print, or at least modify it to make it clear no PMKSA was cached, rather than just printing "nul" or "nil" or "
0x0000".
Sure, that makes sense.
Regards,
-Denis