Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/7bff70e7466dd80603922ba0dfdad1725cce41a6
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/7bff70e7466dd80603922ba0dfdad1725cce41a6
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/7bff70e7466dd80603922ba0dfdad1725cce41a6

The branch, master has been updated
       via  7bff70e7466dd80603922ba0dfdad1725cce41a6 (commit)
      from  7417a21bb1f0e8e00958319f60d8c12a9502a353 (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 -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=7bff70e7466dd80603922ba0dfdad1725cce41a6
commit 7bff70e7466dd80603922ba0dfdad1725cce41a6
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Fix TODO (writing past end of buffer)

diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index f15eb48..c09b283 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -225,18 +225,19 @@ static nserror amiga_nsurl_to_path(struct nsurl *url, 
char **path_out)
        }
 
        colon = strchr(path, ':');
-       if(colon == NULL)
-       {
+       if(colon == NULL) {
                slash = strchr(path, '/');
-               if(slash)
-               {
+               if(slash) {
                        *slash = ':';
-               }
-               else
-               {
+               } else {
+                       char *tmp_path = malloc(path_len + 2);
+                       if(tmp_path == NULL) return NSERROR_NOMEM;
+
+                       strncpy(tmp_path, path, path_len);
+                       free(path);
+
+                       path = tmp_path;
                        path[path_len] = ':';
-                       /* TODO: Looks like we are writing past the end of
-                        * path's allocation here. */
                        path[path_len + 1] = '\0';
                }
        }


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

Summary of changes:
 frontends/amiga/misc.c |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/frontends/amiga/misc.c b/frontends/amiga/misc.c
index f15eb48..c09b283 100755
--- a/frontends/amiga/misc.c
+++ b/frontends/amiga/misc.c
@@ -225,18 +225,19 @@ static nserror amiga_nsurl_to_path(struct nsurl *url, 
char **path_out)
        }
 
        colon = strchr(path, ':');
-       if(colon == NULL)
-       {
+       if(colon == NULL) {
                slash = strchr(path, '/');
-               if(slash)
-               {
+               if(slash) {
                        *slash = ':';
-               }
-               else
-               {
+               } else {
+                       char *tmp_path = malloc(path_len + 2);
+                       if(tmp_path == NULL) return NSERROR_NOMEM;
+
+                       strncpy(tmp_path, path, path_len);
+                       free(path);
+
+                       path = tmp_path;
                        path[path_len] = ':';
-                       /* TODO: Looks like we are writing past the end of
-                        * path's allocation here. */
                        path[path_len + 1] = '\0';
                }
        }


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to