[Bug 2028151] [NEW] Problem with sprintf under Ubuntu 23.04

Launchpad Bug Tracker 2028151 at bugs.launchpad.net
Wed Jul 19 17:31:10 UTC 2023


You have been subscribed to a public bug:

Problem with sprintf under Ubuntu 23.04

I have a problem with a program under Ubuntu 23.04.

If I compile it under 22.04 and copy the binary to 23.04 I see the problem.
Likewise if I compile and run it on 23.04.
On 22.04 I do not see the problem.


#include <stdio.h>

int main(int argc, char** argv)
{
	int ch, i,offset;
	char s_text[60]={0};
	offset=3;
    s_text[0]='*';
	printf("   |%s|\n",s_text);
	for(i = 0; i < offset; ++i)
		{
		sprintf(s_text,"%s.",s_text);
		printf("%d. |%s|\n",i,s_text);
		}
	return 0;
}


// Not working output
//    |*|
// 0. |.|
// 1. |.|
// 2. |.|

If I remove "#include <stdio.h> " it works also under 23.04.
But I need <stdio.h> for other program parts.

// Working output
//    |*|
// 0. |*.|
// 1. |*..|
// 2. |*...|

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: bot-comment
-- 
Problem with sprintf under Ubuntu 23.04 
https://bugs.launchpad.net/bugs/2028151
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to glibc in Ubuntu.



More information about the foundations-bugs mailing list