Discussion:
[edk2] [patch] SecurityPkg: Calculate the length of the String.
Zhang Lubo
2015-06-30 05:26:55 UTC
Permalink
When the two concatenated strings are both not null, the total length in bytes of them should calculate the character '\0' once.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <***@intel.com>
---
.../UserIdentification/UserProfileManagerDxe/UserProfileModify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
index 67fc300..a0eb4af 100644
--- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
+++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
@@ -336,11 +336,11 @@ AddStr (

if (*Source1 == NULL) {
StrLength = StrSize (Source2);
} else {
StrLength = StrSize (*Source1);
- StrLength += StrSize (Source2) -1;
+ StrLength += StrSize (Source2) - 2;
}

TmpStr = AllocateZeroPool (StrLength);
ASSERT (TmpStr != NULL);
--
1.9.5.msysgit.1
Zhang Lubo
2015-07-03 01:33:00 UTC
Permalink
From: "Zhang, Lubo" <***@intel.com>

When the two concatenated strings are both not null, the total length in bytes of them should calculate the character '\0' once.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <***@intel.com>
---
.../UserIdentification/UserProfileManagerDxe/UserProfileModify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
index 67fc300..a0eb4af 100644
--- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
+++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
@@ -336,11 +336,11 @@ AddStr (

if (*Source1 == NULL) {
StrLength = StrSize (Source2);
} else {
StrLength = StrSize (*Source1);
- StrLength += StrSize (Source2) -1;
+ StrLength += StrSize (Source2) - 2;
}

TmpStr = AllocateZeroPool (StrLength);
ASSERT (TmpStr != NULL);
--
1.9.5.msysgit.1
Wu, Jiaxin
2015-07-03 06:37:30 UTC
Permalink
Reviewed-by: jiaxinwu <***@intel.com>

-----Original Message-----
From: Zhang Lubo [mailto:***@intel.com]
Sent: Friday, July 3, 2015 9:33 AM
To: edk2-***@lists.sourceforge.net
Subject: [edk2] [patch] SecurityPkg: Calculate the length of the String.

From: "Zhang, Lubo" <***@intel.com>

When the two concatenated strings are both not null, the total length in bytes of them should calculate the character '\0' once.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <***@intel.com>
---
.../UserIdentification/UserProfileManagerDxe/UserProfileModify.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
index 67fc300..a0eb4af 100644
--- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
+++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileModify.c
@@ -336,11 +336,11 @@ AddStr (

if (*Source1 == NULL) {
StrLength = StrSize (Source2);
} else {
StrLength = StrSize (*Source1);
- StrLength += StrSize (Source2) -1;
+ StrLength += StrSize (Source2) - 2;
}

TmpStr = AllocateZeroPool (StrLength);
ASSERT (TmpStr != NULL);
--
1.9.5.msysgit.1


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
Loading...