[patch] opensync opie plugin patches

View: New views
3 Messages — Rating Filter:   Alert me  

[patch] opensync opie plugin patches

by Erik Hovland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I finally got around to running my static analysis tool on the opie
plugin of opensync. It found some interesting defects.

Let me know if there is anything I can do to improve these patches.

Thanks

E

--
Erik Hovland
mail: erik@...
web: http://hovland.org/
PGP/GPG public key available on request

start_time and end_time are never set. This makes the code
a little farther down dead (never possible to execute).

I assume that start and end come from the DateStarted and
DateEnd fields, so I assign them there.

---

 opie-sync/CMakeLists.txt    |    1 +
 opie-sync/src/opie_format.c |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/opie-sync/CMakeLists.txt b/opie-sync/CMakeLists.txt
index c8a1249..3b8dfd1 100644
--- a/opie-sync/CMakeLists.txt
+++ b/opie-sync/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 2.6)
 PROJECT( libopensync-plugin-opie C )
 
 SET( VERSION "0.36" )
diff --git a/opie-sync/src/opie_format.c b/opie-sync/src/opie_format.c
index dd1548b..cf4ca77 100644
--- a/opie-sync/src/opie_format.c
+++ b/opie-sync/src/opie_format.c
@@ -1100,10 +1100,10 @@ static osync_bool conv_xml_event_to_opie_xml_event(char *input, unsigned int inp
  xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "created");
  }
  else if(!strcmp("DateStarted", fieldname)) {
- xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "start");
+ start_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "start");
  }
  else if(!strcmp("DateEnd", fieldname)) {
- xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "end");
+ start_time = xmlfield_vtime_to_attr_time_t(in_xmlfield, on_event, "end");
  }
  else if(!strcmp("Categories", fieldname)) {
  xmlfield_categories_to_attr(in_xmlfield, on_event, "Categories");

The removed headers provide no useful symbols to the code
that includes them.
---

 opie-sync/src/opie_comms.c  |    1 -
 opie-sync/src/opie_format.c |    1 -
 opie-sync/src/opie_xml.c    |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/opie-sync/src/opie_comms.c b/opie-sync/src/opie_comms.c
index edc8b3e..29e3a4e 100644
--- a/opie-sync/src/opie_comms.c
+++ b/opie-sync/src/opie_comms.c
@@ -35,7 +35,6 @@
 #include <glib/gstdio.h>
 
 #include <curl/curl.h>
-#include <curl/types.h>
 #include <curl/easy.h>
 
 #include <opensync/opensync.h>
diff --git a/opie-sync/src/opie_format.c b/opie-sync/src/opie_format.c
index cf4ca77..15fe86c 100644
--- a/opie-sync/src/opie_format.c
+++ b/opie-sync/src/opie_format.c
@@ -29,7 +29,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <opensync/opensync.h>
 #include <opensync/opensync-time.h>
 #include <opensync/opensync-format.h>
-#include <opensync/opensync-data.h>
 #include <opensync/opensync-merger.h>
 
 enum OpieTodoState {
diff --git a/opie-sync/src/opie_xml.c b/opie-sync/src/opie_xml.c
index fe024b5..3ab7d01 100644
--- a/opie-sync/src/opie_xml.c
+++ b/opie-sync/src/opie_xml.c
@@ -27,7 +27,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "opie_xml.h"
 #include "opie_sync.h"
-#include "opie_comms.h"
 #include "md5.h"
 
 #include <string.h>

mkstemp is the best temp file call. But we need to wrap the
call with umask to make sure it is extra secure.
---

 opie-sync/src/opie_comms.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/opie-sync/src/opie_comms.c b/opie-sync/src/opie_comms.c
index 29e3a4e..e80185a 100644
--- a/opie-sync/src/opie_comms.c
+++ b/opie-sync/src/opie_comms.c
@@ -93,7 +93,9 @@ TempFile *create_temp_file(void) {
 
  TempFile *tmpfile = g_malloc(sizeof(TempFile));
  char *template = g_strdup("/tmp/opie-sync.XXXXXX");
+        mode_t current_mode = umask(S_IRWXG | S_IRWXO);
  tmpfile->fd = mkstemp(template);
+ umask(current_mode);
  if(tmpfile->fd == -1) {
  osync_trace( TRACE_EXIT_ERROR, "failed to create temporary file" );
  g_free(template);

_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
Opie-devel@...
https://handhelds.org/mailman/listinfo/opie-devel

Re: [patch] opensync opie plugin patches

by Bugzilla from bluelightning@bluelightning.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 14 August 2008, Erik Hovland wrote:
> I finally got around to running my static analysis tool on the opie
> plugin of opensync. It found some interesting defects.
>
> Let me know if there is anything I can do to improve these patches.

Thanks. Can't believe I missed the errors fixed by opie-sync-deadcode :O
(although the second change should be end_time= not start_time= ).

OpenSync svn is down at the moment but I'll commit these ASAP. Sorry for the
delay.

Cheers,
Paul
_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
Opie-devel@...
https://handhelds.org/mailman/listinfo/opie-devel

Re: [patch] opensync opie plugin patches

by Erik Hovland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Thanks. Can't believe I missed the errors fixed by opie-sync-deadcode :O
> (although the second change should be end_time= not start_time= ).
>
> OpenSync svn is down at the moment but I'll commit these ASAP. Sorry for the
> delay.

No problem. Hope they help improve the stability of opensync.

E

--
Erik Hovland
erik@...
http://hovland.org/
_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
Opie-devel@...
https://handhelds.org/mailman/listinfo/opie-devel