| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 2/9] xfsdump: Fix overflow of "question" string in Media_prompt_erase() |
| From: | Eric Sandeen <sandeen@xxxxxxxxxx> |
| Date: | Wed, 12 Nov 2014 12:57:11 -0600 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1415818638-32700-1-git-send-email-sandeen@xxxxxxxxxx> |
| References: | <1415818638-32700-1-git-send-email-sandeen@xxxxxxxxxx> |
The string we were sprintf'ing is trivially longer than the array
we allocated for it.
Allocate something big enough, and snprintf to avoid overflow
Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---
dump/content.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dump/content.c b/dump/content.c
index ac19021..786fc52 100644
--- a/dump/content.c
+++ b/dump/content.c
@@ -6174,7 +6174,7 @@ static bool_t
Media_prompt_overwrite( drive_t *drivep )
{
fold_t fold;
- char question[ 100 ];
+ char question[ 110 ];
char *preamblestr[ PREAMBLEMAX ];
size_t preamblecnt;
char *querystr[ QUERYMAX ];
@@ -6201,7 +6201,7 @@ retry:
/* query: ask if overwrite ok
*/
- sprintf( question,
+ snprintf( question, sizeof(question),
"overwrite data on media in "
"drive %u?\n",
(unsigned int)drivep->d_index );
--
1.7.1
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 3/9] xfsdump: fix wrong test for hard stack limit change failure, Eric Sandeen |
|---|---|
| Next by Date: | [PATCH 6/9] xfsdump: free suboptstrs if mlog_init1 fails, Eric Sandeen |
| Previous by Thread: | [PATCH 3/9] xfsdump: fix wrong test for hard stack limit change failure, Eric Sandeen |
| Next by Thread: | Re: [PATCH 2/9] xfsdump: Fix overflow of "question" string in Media_prompt_erase(), Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |