Hello,

Jason White, le Mon 19 Sep 2011 18:38:37 +1000, a écrit :
> @@ -395,6 +395,7 @@ void get_attributes (char *p)
>          break;
>        strncpy (name, p, 250);
>        p = name;
> +      begin = p;

Mmm, no begin should really stay at the beginning of the buffer. But if
you need that to get things done I guess it's because p - begin becomes
greater than 250?  That rather means that we have to increase the size
of the buffer, as is already done in ebook-speaker. Could you try the
attached patch?

Samuel
diff --git a/daisy-player.c b/daisy-player.c
index 2ba53aa..6c3c8f8 100644
--- a/daisy-player.c
+++ b/daisy-player.c
@@ -47,7 +47,7 @@ int smil_file_fd, discinfo_fp, discinfo = 00, multi = 0, 
displaying = 0;
 int playing, just_this_item;
 int bytes_read, current_page_number, total_pages;
 char label[255], clip_str_b[15], clip_str_e[15], bookmark_title[100];
-char tag[255], element[255], search_str[30], tmp_ncx[255], tmp_wav[255];
+char tag[255], element[1024], search_str[30], tmp_ncx[255], tmp_wav[255];
 char daisy_version[25];
 pid_t player_pid, daisy_player_pid;
 double clip_begin, clip_end;
@@ -339,7 +339,7 @@ void html_entities_to_utf8 (char *s)
 
 void get_attributes (char *p)
 {
-   char name[255], *value, *begin;
+   char name[1024], *value, *begin;
    int break2;
 
    *attribute.class = 0;
@@ -367,7 +367,7 @@ void get_attributes (char *p)
    {
       if (*p == '>' || *p == '?')
          return;
-      if (p - begin > 250)
+      if (p - begin > 1000)
       {
          *p = 0;
          return;
@@ -384,7 +384,7 @@ void get_attributes (char *p)
             break2 = 1;
             break;
          } // if
-         if (p - begin > 250)
+        if (p - begin > 1000)
          {
             *p = 0;
             break2 = 1;
@@ -393,7 +393,7 @@ void get_attributes (char *p)
       } // while
       if (break2)
         break;
-      strncpy (name, p, 250);
+      strncpy (name, p, 1000);
       p = name;
       while (! isspace (*p) && *p != '=')
       {
@@ -402,7 +402,7 @@ void get_attributes (char *p)
             break2 = 1;
             break;
          } // if
-         if (p - begin > 250)
+        if (p - begin > 1000)
          {
             *p = 0;
             break2 = 1;
@@ -420,7 +420,7 @@ void get_attributes (char *p)
             break2 = 1;
             break; 
          } // if
-         if (p - begin > 250)
+        if (p - begin > 1000)
          {
             *p = 0;
             break2 = 1;
@@ -436,7 +436,7 @@ void get_attributes (char *p)
       p = value;
       while (*p != '"' && *p != '>' && *p != '?')
       {
-         if (p - begin > 250)
+        if (p - begin > 1000)
          {
             *p = 0;
             break2 = 1;

Reply via email to