patch-symbol_c 511 B

12345678910111213141516
  1. $OpenBSD: patch-symbol_c,v 1.1 2006/10/29 23:14:43 ian Exp $
  2. --- symbol.c.orig Sun Oct 29 17:00:59 2006
  3. +++ symbol.c Sun Oct 29 17:01:25 2006
  4. @@ -21,8 +21,9 @@ install(char* s, int t, double d) /* in
  5. Symbol *sp;
  6. sp = emalloc(sizeof(Symbol));
  7. - sp->name = emalloc(strlen(s)+1); /* +1 for '\0' */
  8. - strcpy(sp->name, s);
  9. + size_t len = strlen(s) + 1;
  10. + sp->name = emalloc(len); /* +1 for '\0' */
  11. + strlcpy(sp->name, s, len);
  12. sp->type = t;
  13. sp->u.val = d;
  14. sp->next = symlist; /* put at front of list */