Skip to contentSkip to conversation

gssd: Fix allocated buffer size for the scraped acceptor name in do_downcall

PATCH In review Veli-Matti Lintu 3 participants 3 messages May 27, 2014 – Jun 1, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 gssd: Fix allocated buffer size for the scraped acceptor name in do_downcall

In reply to a message not in the archive

In commit 51fda07a "gssd: scrape the acceptor name out of the context" the allocated buffer size is not large enough to hold the actual data that is written to the buffer. This fixes the allocated buffer size.

---
 utils/gssd/gssd_proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/gssd/gssd_proc.c +1 -1
index 69bb3c6..40ff188 100644
@@ -696,7 +696,7 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
 	buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
 		sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
 		sizeof(context_token->length) + context_token->length +
-		acceptor->length;
+		sizeof(acceptor->length) + acceptor->length;
 	p = buf = malloc(buf_size);
 	if (!buf)
 		goto out_err;
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#2 lore raw
Quoted 15 lines · On Tue, 27 May 2014 08:50:26 +0000 (UTC) Veli-Matti Lintu…

In commit 51fda07a "gssd: scrape the acceptor name out of the context" the allocated buffer size is not large enough to hold the actual data that is written to the buffer. This fixes the allocated buffer size.

---
 utils/gssd/gssd_proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/gssd/gssd_proc.c +0 -0
index 69bb3c6..40ff188 100644

utils/gssd/gssd_proc.c do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd, · line 702

Quoted 8 lines
utils/gssd/gssd_proc.c +1 -1
@@ -696,7 +696,7 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
 	buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
 		sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
 		sizeof(context_token->length) + context_token->length +
-		acceptor->length;
+		sizeof(acceptor->length) + acceptor->length;
 	p = buf = malloc(buf_size);
 	if (!buf)
 		goto out_err;

Nice catch...

#3 lore raw
In reply to Veli-Matti Lintu
Quoted 6 lines · Veli-Matti Lintu

In commit 51fda07a "gssd: scrape the acceptor name out of the context" the allocated buffer size is not large enough to hold the actual data that is written to the buffer. This fixes the allocated buffer size.

Committed..

steved.

Quoted 18 lines
---
 utils/gssd/gssd_proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/gssd/gssd_proc.c +1 -1
index 69bb3c6..40ff188 100644
@@ -696,7 +696,7 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
 	buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
 		sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
 		sizeof(context_token->length) + context_token->length +
-		acceptor->length;
+		sizeof(acceptor->length) + acceptor->length;
 	p = buf = malloc(buf_size);
 	if (!buf)
 		goto out_err;