Changeset: cbe373b5e5b6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cbe373b5e5b6
Modified Files:
        gdk/gdk_heap.c
Branch: Jul2012
Log Message:

Avoid using strcat (and strncat).


diffs (24 lines):

diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -711,8 +711,7 @@ HEAPsave_intern(Heap *h, const char *nme
                /* anonymous or private VM is saved as if it were malloced */
                store = STORE_MEM;
                assert(strlen(ext) + strlen(suffix) < sizeof(extension));
-               strcpy(extension, ext);
-               strcat(extension, suffix);
+               snprintf(extension, sizeof(extension), "%s%s", ext, suffix);
                ext = extension;
        } else if (store != STORE_MEM) {
                store = h->storage;
@@ -747,8 +746,8 @@ HEAPdelete(Heap *h, const char *o, const
        if (h->copied) {
                return 0;
        }
-       strcpy(ext2, ext);
-       strcat(ext2, ".new");
+       assert(strlen(ext) + strlen(".new") < sizeof(ext2));
+       snprintf(ext2, sizeof(ext2), "%s%s", ext, ".new");
        return (GDKunlink(BATDIR, o, ext) == 0) | (GDKunlink(BATDIR, o, ext2) 
== 0) ? 0 : -1;
 }
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to