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-18


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-188-gbc8b3cd
Date: Sat, 19 Feb 2011 13:14:57 +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  bc8b3cd0f55e571cf84dbd3473bde59498886c06 (commit)
      from  cec5388bf4e339284028315fd8286bfd424e0747 (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=bc8b3cd0f55e571cf84dbd3473bde59498886c06


commit bc8b3cd0f55e571cf84dbd3473bde59498886c06
Author: Daniele Forsi <address@hidden>
Date:   Sat Feb 19 12:33:41 2011 +0100

    Avoid to loop until INT_MAX in fake drive when "end" is used

diff --git a/common/phones/fake.c b/common/phones/fake.c
index 5bf3220..fc7b2af 100644
--- a/common/phones/fake.c
+++ b/common/phones/fake.c
@@ -167,7 +167,9 @@ static gn_error at_sms_get_generic(gn_data *data, struct 
gn_statemachine *state,
 
 static gn_error at_sms_get_static(gn_data *data, struct gn_statemachine 
*state, int position)
 {
-       if (position > sizeof(sms_inbox)/sizeof(char *) || sms_inbox[position - 
1] == NULL)
+       if (position < 1 || position > sizeof(sms_inbox)/sizeof(char *))
+               return GN_ERR_INVALIDLOCATION;
+       if (!sms_inbox[position - 1])
                return GN_ERR_EMPTYLOCATION;
 
        return at_sms_get_generic(data, state, sms_inbox[position - 1]);
@@ -186,7 +188,9 @@ static int at_sms_get_status_static(gn_data *data, struct 
gn_statemachine *state
 
 static gn_error at_sms_delete_static(gn_data *data, struct gn_statemachine 
*state, int position)
 {
-       if (position > sizeof(sms_inbox)/sizeof(char *) || !sms_inbox[position 
- 1])
+       if (position < 1 || position > sizeof(sms_inbox)/sizeof(char *))
+               return GN_ERR_INVALIDLOCATION;
+       if (!sms_inbox[position - 1])
                return GN_ERR_EMPTYLOCATION;
 
        sms_inbox[position - 1] = NULL;
@@ -206,6 +210,10 @@ static gn_error at_sms_get_from_file(gn_data *data, struct 
gn_statemachine *stat
        struct stat buf;
        char path[MAX_PATH_LEN];
 
+       /* Put an arbitrary limit to quit early from gnokii --getsms 1 end */
+       if (position < 1 || position > 100)
+               return GN_ERR_INVALIDLOCATION;
+
        /* iterate to Nth position */
        for (i = 0; i < position; i++) {
                dent = readdir(d);
@@ -253,6 +261,10 @@ static gn_error at_sms_delete_from_file(gn_data *data, 
struct gn_statemachine *s
        struct stat buf;
        char path[MAX_PATH_LEN];
 
+       /* Put an arbitrary limit to quit early from gnokii --deletesms 1 end */
+       if (position < 1 || position > 100)
+               return GN_ERR_INVALIDLOCATION;
+
        /* iterate to Nth position */
        for (i = 0; i < position; i++) {
                dent = readdir(d);
@@ -316,11 +328,6 @@ static gn_error at_sms_get(gn_data *data, struct 
gn_statemachine *state)
                goto out;
        }
        position = data->raw_sms->number;
-       if (position < 1) {
-               e = GN_ERR_INVALIDLOCATION;
-               goto out;
-       }
-
        path = gn_lib_cfg_get("fake_driver", "sms_inbox");
        if (!path || (d = opendir(path)) == NULL)
                e = at_sms_get_static(data, state, position);
@@ -382,11 +389,6 @@ static gn_error at_sms_delete(gn_data *data, struct 
gn_statemachine *state)
                goto out;
        }
        position = data->raw_sms->number;
-       if (position < 1) {
-               e = GN_ERR_INVALIDLOCATION;
-               goto out;
-       }
-
        path = gn_lib_cfg_get("fake_driver", "sms_inbox");
        if (!path || (d = opendir(path)) == NULL)
                e = at_sms_delete_static(data, state, position);

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

Summary of changes:
 common/phones/fake.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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