logo       


src/d2c/runtime/c-code main.c,1.26,1.27: msg#00001

Subject: src/d2c/runtime/c-code main.c,1.26,1.27
Update of /var/lib/cvs/src/d2c/runtime/c-code
In directory cantor:/tmp/cvs-serv13902/c-code

Modified Files:
        main.c 
Log Message:
Use strncpy rather than strcpy.  Also, use result of strlen instead
of multiple calls to strlen.


Index: main.c
===================================================================
RCS file: /var/lib/cvs/src/d2c/runtime/c-code/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- main.c      3 Oct 2003 20:21:19 -0000       1.26
+++ main.c      2 Dec 2003 16:14:34 -0000       1.27
@@ -72,16 +72,18 @@
   descriptor_t tmp;
   descriptor_t *stack = gdb_stack_stack[gdb_stack_stack_index];
   void **dylan_str;
+  size_t len = 0;
 
   if (stack == 0)
     stack = gdb_stack_stack[gdb_stack_stack_index]
       = (descriptor_t *) malloc(GDB_STACK_SIZE);
+  len = strlen(arg);
 
   dylan_str = (void **)
-    GC_malloc(sizeof(struct heapobj *) + sizeof(long) + strlen(arg));
+    GC_malloc(sizeof(struct heapobj *) + sizeof(long) + len);
   dylan_str[0] = (void *)(&dylanZdylan_visceraZCLS_byte_string_HEAP);
-  dylan_str[1] = (void *)strlen(arg);
-  strcpy((char *)(&dylan_str[2]), arg);
+  dylan_str[1] = (void *)len;
+  strncpy((char *)(&dylan_str[2]), arg, len);
 
   tmp.heapptr = (struct heapobj *)dylan_str;
   tmp.dataword.l = 0;

_______________________________________________
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
http://www.gwydiondylan.org/mailman/listinfo/gd-chatter



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe