summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/smi_video.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/smi_video.c b/src/smi_video.c
index 6266011..055f606 100644
--- a/src/smi_video.c
+++ b/src/smi_video.c
@@ -518,14 +518,18 @@ SMI_AddEncoding(XF86VideoEncodingPtr enc, int i,
norm_string = VideoNorms[norm].name;
input_string = VideoInputs[input].name;
- sprintf(channel_string, "%d", channel);
+ snprintf(channel_string, sizeof(channel_string), "%d", channel);
enc[i].id = i;
- name_string = malloc(strlen(norm_string) +
- strlen(input_string) +
- strlen(channel_string)+3);
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+ if (Xasprintf(&name_string, "%s-%s-%s",
+ norm_string, input_string, channel_string) < 0)
+ LEAVE(-1);
+#else
+ name_string = Xprintf("%s-%s-%s",
+ norm_string, input_string, channel_string);
if (NULL == name_string)
LEAVE(-1);
- sprintf(name_string,"%s-%s-%s", norm_string, input_string, channel_string);
+#endif
enc[i].name = name_string;
enc[i].width = VideoNorms[norm].Wa;