Changeset a8938c7


Ignore:
Timestamp:
Jun 25, 2003, 2:04:05 AM (17 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
591e6aa7
Parents:
3733dc2
Message:
Fixed some easy fixed length buffer problems
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    re75713e ra8938c7  
    2222        Don't allow sending to AIM users with spaces
    2323        Removed libfaim/config.log from CVS
     24        Fixed some easy fixed-length buffers
    2425
    25262.0.4-pre-1
  • global.c

    ref56a67 ra8938c7  
    2525  hent=gethostbyname(hostname);
    2626  if (!hent) {
    27     strcpy(g->thishost, "localhost");
     27    g->thishost=owl_strdup("localhost");
    2828  } else {
    29     strcpy(g->thishost, hent->h_name);
     29    g->thishost=owl_strdup(hent->h_name);
    3030  }
    3131
     
    3535  g->topmsg=0;
    3636  g->needrefresh=1;
     37  g->startupargs=NULL;
    3738
    3839  owl_variable_dict_setup(&(g->vars));
     
    6667  g->searchstring=NULL;
    6768  g->starttime=time(NULL); /* assumes we call init only a start time */
    68   strcpy(g->buffercommand, "");
     69  g->buffercommand=NULL;
    6970  g->newmsgproc_pid=0;
    7071 
     
    8485  /* Fill in some variables which don't have constant defaults */
    8586  /* TODO: come back later and check passwd file first */
    86   strcpy(g->homedir, getenv("HOME"));
     87  g->homedir=owl_strdup(getenv("HOME"));
    8788
    8889  owl_messagelist_create(&(g->msglist));
     
    228229
    229230void owl_global_set_buffercommand(owl_global *g, char *command) {
    230   strcpy(g->buffercommand, command);
     231  if (g->buffercommand) owl_free(g->buffercommand);
     232  g->buffercommand=owl_strdup(command);
    231233}
    232234
    233235char *owl_global_get_buffercommand(owl_global *g) {
    234   return(g->buffercommand);
     236  if (g->buffercommand) return(g->buffercommand);
     237  return("");
    235238}
    236239
     
    294297
    295298char *owl_global_get_homedir(owl_global *g) {
    296   return(g->homedir);
     299  if (g->homedir) return(g->homedir);
     300  return("/");
    297301}
    298302
     
    428432
    429433char *owl_global_get_hostname(owl_global *g) {
    430   return(g->thishost);
     434  if (g->thishost) return(g->thishost);
     435  return("");
    431436}
    432437
     
    470475
    471476void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
    472   int i;
     477  int i, len;
     478
     479  if (g->startupargs) owl_free(g->startupargs);
     480 
     481  len=0;
     482  for (i=0; i<argc; i++) {
     483    len+=strlen(argv[i]+5);
     484  }
     485  g->startupargs=malloc(len+5);
    473486
    474487  strcpy(g->startupargs, "");
     
    480493
    481494char *owl_global_get_startupargs(owl_global *g) {
    482   return(g->startupargs);
     495  if (g->startupargs) return(g->startupargs);
     496  return("");
    483497}
    484498
  • owl.h

    rce7db4d ra8938c7  
    405405  int recwinlines;
    406406  int typwinactive;
    407   char thishost[LINE];
    408   char homedir[LINE];
     407  char *thishost;
     408  char *homedir;
    409409  int direction;
    410410  int zaway;
     
    412412  int haveconfig;
    413413  int config_format;
    414   char buffercommand[1024];
     414  char *buffercommand;
    415415  owl_editwin tw;
    416416  owl_viewwin vw;
     
    418418  int debug;
    419419  int starttime;
    420   char startupargs[LINE];
     420  char *startupargs;
    421421  int userclue;
    422422  int nextmsgid;
Note: See TracChangeset for help on using the changeset viewer.