aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/lcGeneric.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/lcGeneric.c')
-rw-r--r--nx-X11/lib/X11/lcGeneric.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/nx-X11/lib/X11/lcGeneric.c b/nx-X11/lib/X11/lcGeneric.c
index 619cb47f9..f604fe23d 100644
--- a/nx-X11/lib/X11/lcGeneric.c
+++ b/nx-X11/lib/X11/lcGeneric.c
@@ -428,17 +428,17 @@ read_charset_define(
for (i=0; ; i++) { /* loop start */
charsetd = 0;
- sprintf(csd, "csd%d", i);
+ snprintf(csd, sizeof(csd), "csd%d", i);
/* charset_name */
- sprintf(name, "%s.%s", csd, "charset_name");
+ snprintf(name, sizeof(name), "%s.%s", csd, "charset_name");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
_XlcDbg_printValue(name,value,num);
if (num > 0) {
/* hackers will get truncated -- C'est la vie */
strncpy(cset_name,value[0], sizeof cset_name - 1);
cset_name[(sizeof cset_name) - 1] = '\0';
- sprintf(name, "%s.%s", csd , "side");
+ snprintf(name, sizeof(name), "%s.%s", csd , "side");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -470,21 +470,21 @@ read_charset_define(
/* side */
charsetd->side = side ;
/* length */
- sprintf(name, "%s.%s", csd, "length");
+ snprintf(name, sizeof(name), "%s.%s", csd, "length");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
charsetd->char_size = atoi(value[0]);
}
/* gc_number */
- sprintf(name, "%s.%s", csd, "gc_number");
+ snprintf(name, sizeof(name), "%s.%s", csd, "gc_number");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
charsetd->set_size = atoi(value[0]);
}
/* string_encoding */
- sprintf(name, "%s.%s", csd, "string_encoding");
+ snprintf(name, sizeof(name), "%s.%s", csd, "string_encoding");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -495,7 +495,7 @@ read_charset_define(
}
}
/* sequence */
- sprintf(name, "%s.%s", csd, "sequence");
+ snprintf(name, sizeof(name), "%s.%s", csd, "sequence");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -511,7 +511,7 @@ read_charset_define(
string_to_encoding(value[0],tmp);
}
/* encoding_name */
- sprintf(name, "%s.%s", csd, "encoding_name");
+ snprintf(name, sizeof(name), "%s.%s", csd, "encoding_name");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -565,10 +565,10 @@ read_segmentconversion(
SegConv conversion;
for (i=0 ; ; i++) { /* loop start */
conversion = 0;
- sprintf(conv, "conv%d", i);
+ snprintf(conv, sizeof(conv), "conv%d", i);
/* length */
- sprintf(name, "%s.%s", conv, "length");
+ snprintf(name, sizeof(name), "%s.%s", conv, "length");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
if (conversion == NULL &&
@@ -585,7 +585,7 @@ read_segmentconversion(
conversion->length = atoi(value[0]);
/* source_encoding */
- sprintf(name, "%s.%s", conv, "source_encoding");
+ snprintf(name, sizeof(name), "%s.%s", conv, "source_encoding");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
char *tmp;
@@ -597,7 +597,7 @@ read_segmentconversion(
conversion->source = srch_charset_define(tmp,&new);
}
/* destination_encoding */
- sprintf(name, "%s.%s", conv, "destination_encoding");
+ snprintf(name, sizeof(name), "%s.%s", conv, "destination_encoding");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
char *tmp;
@@ -609,7 +609,7 @@ read_segmentconversion(
conversion->dest = srch_charset_define(tmp,&new);
}
/* range */
- sprintf(name, "%s.%s", conv, "range");
+ snprintf(name, sizeof(name), "%s.%s", conv, "range");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -617,7 +617,7 @@ read_segmentconversion(
&(conversion->range.start), &(conversion->range.end));
}
/* conversion */
- sprintf(name, "%s.%s", conv, "conversion");
+ snprintf(name, sizeof(name), "%s.%s", conv, "conversion");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -635,6 +635,7 @@ create_ctextseg(
ExtdSegment ret;
char* ptr;
char* cset_name = NULL;
+ size_t cset_len;
int i,new;
FontScope scope;
ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
@@ -645,7 +646,8 @@ create_ctextseg(
Xfree (ret);
return NULL;
}
- cset_name = (char*) Xmalloc (strlen(ret->name) + 1);
+ cset_len = strlen(ret->name) + 1;
+ cset_name = Xmalloc (cset_len);
if (cset_name == NULL) {
Xfree (ret->name);
Xfree (ret);
@@ -657,10 +659,10 @@ create_ctextseg(
ptr++;
if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) {
ret->side = XlcGL;
- sprintf(cset_name,"%s:%s",ret->name,"GL");
+ snprintf(cset_name, cset_len, "%s:%s", ret->name, "GL");
} else {
ret->side = XlcGR;
- sprintf(cset_name,"%s:%s",ret->name,"GR");
+ snprintf(cset_name, cset_len, "%s:%s", ret->name, "GR");
}
} else {
ret->side = XlcGLGR;
@@ -731,10 +733,10 @@ load_generic(
char cs[16];
char name[BUFSIZ];
- sprintf(cs, "cs%d", i);
+ snprintf(cs, sizeof(cs), "cs%d", i);
/***** codeset.side *****/
- sprintf(name, "%s.%s", cs , "side");
+ snprintf(name, sizeof(name), "%s.%s", cs , "side");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
char *tmp;
@@ -761,7 +763,7 @@ load_generic(
}
/***** codeset.length *****/
- sprintf(name, "%s.%s", cs , "length");
+ snprintf(name, sizeof(name), "%s.%s", cs , "length");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
@@ -772,7 +774,7 @@ load_generic(
}
/***** codeset.mb_encoding *****/
- sprintf(name, "%s.%s", cs, "mb_encoding");
+ snprintf(name, sizeof(name), "%s.%s", cs, "mb_encoding");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
static struct {
@@ -808,7 +810,7 @@ load_generic(
}
/***** codeset.wc_encoding *****/
- sprintf(name, "%s.%s", cs, "wc_encoding");
+ snprintf(name, sizeof(name), "%s.%s", cs, "wc_encoding");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
@@ -819,7 +821,7 @@ load_generic(
}
/***** codeset.ct_encoding *****/
- sprintf(name, "%s.%s", cs, "ct_encoding");
+ snprintf(name, sizeof(name), "%s.%s", cs, "ct_encoding");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
char *encoding;
@@ -861,7 +863,7 @@ load_generic(
unsigned long start,end;
ByteInfo tmpb;
- sprintf(name,"%s.%s%d",cs,"byte",M);
+ snprintf(name, sizeof(name),"%s.%s%d",cs,"byte",M);
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (M == 1) {
@@ -896,7 +898,7 @@ load_generic(
/***** codeset.mb_conversion *****/
- sprintf(name, "%s.%s", cs, "mb_conversion");
+ snprintf(name, sizeof(name), "%s.%s", cs, "mb_conversion");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -908,7 +910,7 @@ load_generic(
/* [\x%x,\x%x]->\x%x,... */
}
/***** codeset.ct_conversion *****/
- sprintf(name, "%s.%s", cs, "ct_conversion");
+ snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -920,14 +922,14 @@ load_generic(
/* [\x%x,\x%x]->\x%x,... */
}
/***** codeset.ct_conversion_file *****/
- sprintf(name, "%s.%s", cs, "ct_conversion_file");
+ snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion_file");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
/* [\x%x,\x%x]->\x%x,... */
}
/***** codeset.ct_extended_segment *****/
- sprintf(name, "%s.%s", cs, "ct_extended_segment");
+ snprintf(name, sizeof(name), "%s.%s", cs, "ct_extended_segment");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);