There are two angles to this:
How long before it makes stock taste bad?
Smell is a good cue here, but I have made stock even with meat and bones that smell a bit "off." No bad flavor or smell was noticeable in the soup/stew.
How long before it is unsafe?
The long periods of high temperature involved in making stock will kill any germs. I have used old meat for this purpose and had no nausea or diarrhea afterwards (the usual signs of food poisoning). At high levels of decay where you notice a rotting or putrescent smell there may be some unhealthy compounds created that are not destroyed by cooking, but I am sure the smell taste will be so bad in that case, that it would be difficult even to swallow.
At normal refrigeration temperatures, it takes much much longer than 40 hours to reach either of these thresholds.