gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-47


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-476-g6b41ec2
Date: Thu, 18 Apr 2013 12:47:11 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  6b41ec2579e2fdf3d4866db8d6c48fd7e990decf (commit)
      from  53b3243f91e1c2cf894b085842864a4c6b5f42f1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=6b41ec2579e2fdf3d4866db8d6c48fd7e990decf


commit 6b41ec2579e2fdf3d4866db8d6c48fd7e990decf
Author: Daniele Forsi <address@hidden>
Date:   Thu Apr 18 14:34:45 2013 +0200

    Fix usage of fread() and NUL-terminate the buffer
    
    Return value can't be negative because it is a size_t. Swap the values for
    "size" and "nmemb" else it's unlikely that it reads 1 element that big and
    in common cases the return value would be 0 meaning "short item count".

diff --git a/testsuite/dump-vcard.c b/testsuite/dump-vcard.c
index 9e66548..89ae62b 100644
--- a/testsuite/dump-vcard.c
+++ b/testsuite/dump-vcard.c
@@ -41,6 +41,8 @@ int main (int argc, char **argv)
        }
 
        if (!is_stdin) {
+               size_t count;
+
                /* Seek back to the beginning and read in memory */
                if (fseek (f, 0, SEEK_SET) < 0) {
                        perror ("Seeking back failed");
@@ -55,12 +57,14 @@ int main (int argc, char **argv)
                        fclose (f);
                        return 1;
                }
-               if (fread (buf, 1024 * 1024, 1, f) < 0) {
+               count = fread (buf, 1, 1024 * 1024, f);
+               if (count == 0) {
                        perror ("Failed to read");
                        free (buf);
                        fclose (f);
                        return 1;
                }
+               buf[count - 1] = '\0';
 
                fclose (f);
 

-----------------------------------------------------------------------

Summary of changes:
 testsuite/dump-vcard.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]