Fixed unsigned to signed cast in replacement for strdup