Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2000:
[Freeciv-Dev] patch: safer string handling: server (PR#220)
Home

[Freeciv-Dev] patch: safer string handling: server (PR#220)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] patch: safer string handling: server (PR#220)
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sat, 1 Jan 2000 01:01:05 -0800 (PST)

This is another mostly straightforward but tedious patch 
to do safer string operations, this time for server/*.c.
Similar comments apply as regarding common/*.c;
this requires the sz_strlcpy()/sz_strlcat() patch from
previous post.

Notable parts of patch:

- pick_ai_player_name() did lots of unnecessary string copies, so
  I re-wrote it; while doing so I changed it to try more random 
  names, before resorting to sequential.

- added field "sz_svalue" in struct settings_s (stdinhand.c),
  as addition of demography means the string values do not all 
  have the same size available.

Minor code fixes:
 - sprintf with "non-format" string -> strlcpy;
 - explicit malloc+strcpy -> mystrdup;
 - removed some unnecessary intermediate string buffers.

-- David

Attachment: safe_str_server.diff.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] patch: safer string handling: server (PR#220), David Pfitzner <=