Hello,
I have a patch for Erss for you and I hope you enjoy it.

Take the rss-feed located at "http://www.edevelop.org/planet/rss20.xml";,
which has following news item for example:
  <item>
         <title>RbdPngn: South Park Character</title>
         <guid></guid>
         <link></link>
         <description>Ben  pointed out [unnecessary ...]</description>
         <pubDate>Sun, 08 May 2005 02:50:00 +0000</pubDate>
  </item>

You'll get a segmentation fault when trying to load this item, because
  static void erss_parse_story (Erss_Feed *f, xmlNodePtr cur)
in parse.c in line 84:
  83: if (!strcmp(cur->name, cfg->item_url) && f->item) {
  84:     str = xmlNodeListGetString(f->doc, cur->xmlChildrenNode, 1);
does not check whether cur->xmlChildrenNode - or let's say str,
because xmlNodeListGetString doesn't complain about
cur->xmlChildrenNode being NULL - is NULL.
Subsequent
  strdup(str)
will fail accordingly.

str could be set to some special value like "<empty>" (well you could
also just leave set it an empty string...), so that
  static void erss_mouse_click_item (void *data, Evas_Object *o,
                                    const char *sig, const char *src)
in gui.c, beginning with line 99, may catch this situation.

By the way of digging in that function I expanded the browser-compatibilty.
You can now set your browser to something like:
  <browser>firefox -remote "openUrl($url, new-tab)"</browser>
making your opportunities to open your link more open

You may ask, why I didn't just set "%s" as some sort of "url-qualifier" and
leave the replacement up to snprintf(). The reason is that a user could misuse
this browser-line. Try this for example and you'll se what I mean:
  char format[100] = "%s %s %s";
  char target[100];
  printf("format: %s\n", format);
  sprintf(target, format, "SOMEURL");
  printf("target: %s\n", target);


My patched function in gui.c now looks like:

static void erss_mouse_click_item (void *data, Evas_Object *o,
                                   const char *sig, const char *src)
{
        char *url = (char *)data, *p = NULL, *c = NULL;

        if (!url || !strcmp(url,"<empty>"))
                return;

        if (!rc->browser || ! (p = strstr(rc->browser, "$url"))) {
                /* The browser line (if any supplied) is useless */
                if (rc->browser)
                        free(rc->browser);
                fprintf (stderr,
"%s notice: you have not defined any browser in your config file or in the "
"environment variable `BROWSER'.\n"
" * using `mozilla \"$url\"'\n", PACKAGE);
                rc->browser = strdup("mozilla \"$url\"");
        }

        /* Add 1, because of '\0', and substract 4,
           because the 4 letters '$url' of rc->browser will be replaced.
           -4 + 1 = -3 */
        c = malloc(strlen(rc->browser)+strlen(url)-3);

        if ( (p = strstr(rc->browser, "$url"))) {
                /* Replaces '$url' with real url */
                strncpy(c, rc->browser, p - rc->browser);
                strcat(c, url);
                strcat(c, p+4);
        } else {
                /* Will never happen */
        }

        ecore_exe_run(c, NULL);
        free(c);
}

Ps.: Hope you like it.
- Regards, Eddy

______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to