Commit 5b3715bfdafcf35c352aa6d273cadd4eb543c449

Authored by blueswir1
1 parent fbc190d8

Use snprintf to please OpenBSD linker

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5529 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 9 deletions
gdbstub.c
@@ -1050,12 +1050,12 @@ const char *get_feature_xml(CPUState *env, const char *p, const char **newp) @@ -1050,12 +1050,12 @@ const char *get_feature_xml(CPUState *env, const char *p, const char **newp)
1050 if (!target_xml[0]) { 1050 if (!target_xml[0]) {
1051 GDBRegisterState *r; 1051 GDBRegisterState *r;
1052 1052
1053 - sprintf(target_xml,  
1054 - "<?xml version=\"1.0\"?>"  
1055 - "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">"  
1056 - "<target>"  
1057 - "<xi:include href=\"%s\"/>",  
1058 - GDB_CORE_XML); 1053 + snprintf(target_xml, sizeof(target_xml),
  1054 + "<?xml version=\"1.0\"?>"
  1055 + "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">"
  1056 + "<target>"
  1057 + "<xi:include href=\"%s\"/>",
  1058 + GDB_CORE_XML);
1059 1059
1060 for (r = env->gdb_regs; r; r = r->next) { 1060 for (r = env->gdb_regs; r; r = r->next) {
1061 strcat(target_xml, "<xi:include href=\""); 1061 strcat(target_xml, "<xi:include href=\"");
@@ -1426,7 +1426,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) @@ -1426,7 +1426,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
1426 } 1426 }
1427 #endif 1427 #endif
1428 if (strncmp(p, "Supported", 9) == 0) { 1428 if (strncmp(p, "Supported", 9) == 0) {
1429 - sprintf(buf, "PacketSize=%x", MAX_PACKET_LENGTH); 1429 + snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH);
1430 #ifdef GDB_CORE_XML 1430 #ifdef GDB_CORE_XML
1431 strcat(buf, ";qXfer:features:read+"); 1431 strcat(buf, ";qXfer:features:read+");
1432 #endif 1432 #endif
@@ -1442,7 +1442,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) @@ -1442,7 +1442,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
1442 p += 19; 1442 p += 19;
1443 xml = get_feature_xml(env, p, &p); 1443 xml = get_feature_xml(env, p, &p);
1444 if (!xml) { 1444 if (!xml) {
1445 - sprintf(buf, "E00"); 1445 + snprintf(buf, sizeof(buf), "E00");
1446 put_packet(s, buf); 1446 put_packet(s, buf);
1447 break; 1447 break;
1448 } 1448 }
@@ -1456,7 +1456,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) @@ -1456,7 +1456,7 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf)
1456 1456
1457 total_len = strlen(xml); 1457 total_len = strlen(xml);
1458 if (addr > total_len) { 1458 if (addr > total_len) {
1459 - sprintf(buf, "E00"); 1459 + snprintf(buf, sizeof(buf), "E00");
1460 put_packet(s, buf); 1460 put_packet(s, buf);
1461 break; 1461 break;
1462 } 1462 }