| Submitter | Colin King |
|---|---|
| Date | Oct. 14, 2012, 8:31 p.m. |
| Message ID | <1350246738-31699-5-git-send-email-colin.king@canonical.com> |
| Download | mbox | patch |
| Permalink | /patch/191393/ |
| State | Accepted |
| Headers | show |
Comments
On 10/15/2012 04:31 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > fwts_framework_strtrunc() string length parameter max needs to be a > size_t rather than an int. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_framework.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c > index 927ee54..aa26d4b 100644 > --- a/src/lib/src/fwts_framework.c > +++ b/src/lib/src/fwts_framework.c > @@ -287,7 +287,7 @@ static void fwts_framework_show_tests(fwts_framework *fw, bool full) > * fwts_framework_strtrunc() > * truncate overlong string > */ > -static void fwts_framework_strtrunc(char *dest, const char *src, int max) > +static void fwts_framework_strtrunc(char *dest, const char *src, size_t max) > { > strncpy(dest, src, max); > > Acked-by: Alex Hung <alex.hung@canonical.com>
On Mon, Oct 15, 2012 at 4:31 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > fwts_framework_strtrunc() string length parameter max needs to be a > size_t rather than an int. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_framework.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c > index 927ee54..aa26d4b 100644 > --- a/src/lib/src/fwts_framework.c > +++ b/src/lib/src/fwts_framework.c > @@ -287,7 +287,7 @@ static void fwts_framework_show_tests(fwts_framework *fw, bool full) > * fwts_framework_strtrunc() > * truncate overlong string > */ > -static void fwts_framework_strtrunc(char *dest, const char *src, int max) > +static void fwts_framework_strtrunc(char *dest, const char *src, size_t max) > { > strncpy(dest, src, max); > > -- > 1.7.10.4 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Patch
diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 927ee54..aa26d4b 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -287,7 +287,7 @@ static void fwts_framework_show_tests(fwts_framework *fw, bool full) * fwts_framework_strtrunc() * truncate overlong string */ -static void fwts_framework_strtrunc(char *dest, const char *src, int max) +static void fwts_framework_strtrunc(char *dest, const char *src, size_t max) { strncpy(dest, src, max);